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

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

  1. #1

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

    سلام روز بخیر
    میخواهم سرچ جوری بنویسم که تک تک کاراکترهای ورودی پیدا کنه
    مثلا اگه کاربر بزنه 658 تمام
    6 ها و 5 ها و 8 ها و 65 ها و58 ها و 658 ها پیدا کنه
    منظورم درست رسوندم؟؟؟؟

  2. #2
    مدیر بخش آواتار ژیار رحیمی
    تاریخ عضویت
    مهر 1386
    محل زندگی
    تهران
    پست
    1,095

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

    سلام .جهت این جور search ها از regx استفاده میکنند. در مورد regular expression در #c جستجو کنید
    First,solve the problem then write the code

  3. #3
    کاربر دائمی آواتار 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 عصر

  4. #4

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

    s
    نقل قول نوشته شده توسط alexmcse مشاهده تاپیک
    مثال

    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.
    سلام ممنون امکانش هست یه توضیح کوتاه در مورد این کد بدید؟؟؟

  5. #5

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

    نقل قول نوشته شده توسط ژیار رحیمی مشاهده تاپیک
    سلام .جهت این جور search ها از regx استفاده میکنند. در مورد regular expression در #c جستجو کنید
    سلام ممنون از راهنماییتون اگه ممکنه یه سوال داشتم
    من میخواهم تمام رشته هایی که هم 3 و هم 7 (حداقل یکی)داخلش هست و بقیه رشته هر کاراکتری ممکنه باشه فازسی یا انگلیسی عدد یا .و.... برام نمایش بده
    Regex rgx = new Regex(str)
    str چی باید ینویسم؟؟؟

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

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

    نقل قول نوشته شده توسط mehdi0020 مشاهده تاپیک
    سلام ممنون از راهنماییتون اگه ممکنه یه سوال داشتم
    من میخواهم تمام رشته هایی که هم 3 و هم 7 (حداقل یکی)داخلش هست و بقیه رشته هر کاراکتری ممکنه باشه فازسی یا انگلیسی عدد یا .و.... برام نمایش بده
    Regex rgx = new Regex(str)
    str چی باید ینویسم؟؟؟
         private readonly List<int> listAll = new List<int>() {1, 2, 3, 35, 47,87, 335};        private void button3_Click(object sender, EventArgs e)
    {
    var s = "";


    foreach (var VARIABLE in listAll )
    {
    if (VARIABLE.ToString().StartsWith("3"))
    s = s + VARIABLE + Environment.NewLine;
    }
    MessageBox.Show(s);
    //StartsWith
    //استفاده کنید
    }

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

  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 صبح

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

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