نمایش نتایج 1 تا 6 از 6

نام تاپیک: سوال در مورد سرچ با استفاده از BindingSource

Threaded View

پست قبلی پست قبلی   پست بعدی پست بعدی
  1. #5
    کاربر دائمی آواتار alexmcse
    تاریخ عضویت
    فروردین 1391
    محل زندگی
    شیراز
    پست
    860

    نقل قول: سوال در مورد سرچ با استفاده از BindingSource

    مثال

    using System;using System.Globalization;
    using System.Text.RegularExpressions;


    public class Example
    {
    public static void Main()
    {
    // Get the current NumberFormatInfo object to build the regular
    // expression pattern dynamically.
    NumberFormatInfo nfi = NumberFormatInfo.CurrentInfo;


    // Define the regular expression pattern.
    string pattern;
    pattern = @"^\s*[";
    // Get the positive and negative sign symbols.
    pattern += Regex.Escape(nfi.PositiveSign + nfi.NegativeSign) + @"]?\s?";
    // Get the currency symbol.
    pattern += Regex.Escape(nfi.CurrencySymbol) + @"?\s?";
    // Add integral digits to the pattern.
    pattern += @"(\d*";
    // Add the decimal separator.
    pattern += Regex.Escape(nfi.CurrencyDecimalSeparator) + "?";
    // Add the fractional digits.
    pattern += @"\d{";
    // Determine the number of fractional digits in currency values.
    pattern += nfi.CurrencyDecimalDigits.ToString() + "}?){1}$";

    Regex rgx = new Regex(pattern);


    // Define some test strings.
    string[] tests = { "-42", "19.99", "0.001", "100 USD",
    ".34", "0.34", "1,052.21", "$10.62",
    "+1.43", "-$0.23" };


    // Check each test string against the regular expression.
    foreach (string test in tests)
    {
    if (rgx.IsMatch(test))
    Console.WriteLine("{0} is a currency value.", test);
    else
    Console.WriteLine("{0} is not a currency value.", test);
    }
    }
    }
    // The example displays the following output:
    // -42 is a currency value.
    // 19.99 is a currency value.
    // 0.001 is not a currency value.
    // 100 USD is not a currency value.
    // .34 is a currency value.
    // 0.34 is a currency value.
    // 1,052.21 is not a currency value.
    // $10.62 is a currency value.
    // +1.43 is a currency value.
    // -$0.23 is a currency value.
    آخرین ویرایش به وسیله alexmcse : شنبه 11 اسفند 1397 در 23:09 عصر

تاپیک های مشابه

  1. استفاده از bindingsource در Ado.net
    نوشته شده توسط negar.rafie در بخش C#‎‎
    پاسخ: 1
    آخرین پست: یک شنبه 23 آبان 1395, 19:08 عصر
  2. سوال: چرا باید از Bindingsource استفاده کرد؟
    نوشته شده توسط r. salehi در بخش دسترسی به داده ها (ADO.Net و LINQ و ...)
    پاسخ: 1
    آخرین پست: پنج شنبه 02 شهریور 1391, 17:04 عصر
  3. گفتگو: مشکلات استفاده از بیندینگ سورسها (BindingSource)
    نوشته شده توسط mahdimahdi58 در بخش C#‎‎
    پاسخ: 0
    آخرین پست: چهارشنبه 26 مرداد 1390, 01:23 صبح
  4. سوال: سوالاتی در مورد TableAdaptor و BindingSource
    نوشته شده توسط babakkiani در بخش C#‎‎
    پاسخ: 1
    آخرین پست: پنج شنبه 30 دی 1389, 23:29 عصر
  5. سوال: فیلتر کردن با استفاده از BindingSource.Filter
    نوشته شده توسط m_azari16 در بخش VB.NET
    پاسخ: 13
    آخرین پست: جمعه 08 مرداد 1389, 00:33 صبح

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •