Tag Archives: c#

How to search through all items of a combobox in C#?

c# Shrp Programing

بدست آوردن متن همه آیتمهای داخل یک کومبو باکس در برنامه نویسی با C# I have a combobox, and I would like to search through every element in it. How can I do this? (also the number of items is not the same everytime, but this is not so important). I am using c# windows form application. you can do …

Read More »

خطا در زمان بیلد پروژه RROR OCCURRED WHILE SIGNING

c# Shrp Programing

VISUAL STUDIO 2015 – AN ERROR OCCURRED WHILE SIGNING: FAILED TO SIGN SIGNTOOL ERROR: NO CERTIFICATES WERE FOUND THAT MET ALL THE GIVEN CRITERIA Getting An error occurred while signing: Failed to sign file.exe. SignTool Error: No certificates were found that met all the given criteria در زمان بروز این خطا بر روی پروژه رایت کلیک کرده و گزینه تنظیمات …

Read More »

split ، تقسیم و جدا کردن یک متن بر اساس یک کاراکتر

c# Shrp Programing

How do I split a string by a multi-character delimiter in C# ? What if I want to split a string using a delimiter that is a word? string source = “[stop]ONE[stop][stop]TWO[stop][stop][stop]THREE[stop][stop]”; string[] stringSeparators = new string[] {“[stop]”}; string[] result; // … result = source.Split(stringSeparators, StringSplitOptions.None); foreach (string s in result) { Console.Write(“‘{0}’ “, String.IsNullOrEmpty(s) ? “<>” : s); } …

Read More »

Asp.net webforms 4.5 TreeView Populate from Database SQL

لیست id والدهای یک نود و pid در سیستم سلسله مراتبی

نمایش ساختار درختی سلسله مراتبی در  asp.net webforms ورژن ۴٫۵ string str_ConnectionStrings; protected void Page_Load(object sender, EventArgs e) { str_ConnectionStrings = ConfigurationManager.ConnectionStrings[“Atlas_PublicConnectionString”].ConnectionString; BindTreeViewControl(); } DataSet P_Dataset(string str_SQL) { SqlDataAdapter adp = new SqlDataAdapter(str_SQL, str_ConnectionStrings); DataSet obj_DataSet = new DataSet(); adp.Fill(obj_DataSet, “TableName”); return obj_DataSet; } private void BindTreeViewControl() { try { DataSet obj_DataSet = P_Dataset(“Select id,name,pid from z_tbl_Tree”); DataRow[] Rows = …

Read More »

Search and Highlight Text in a RichTextBox

c# Shrp Programing

tep 1: Create a new Windows Forms application. Drag and drop a RichTextBox(rtb) control, a textbox(txtSearch) and a button(btnFind) control to the form. The textbox will be used to enter the search string and on the button click, we will be performing a search in the RichTextBox. Add a class level variable called ‘start’. This variable will be the start …

Read More »

Get plain text from an RTF text

RTF Document

[php] static public string ConvertToText(string rtf) { using(RichTextBox rtb = new RichTextBox()) { rtb.Rtf = rtf; return rtb.Text; } } [/php]

Read More »

بدست آوردن مشخصات فلش مموری در C# Finding a USB mass storage devices “disk letter” by its PID and VID number or name

c# Shrp Programing

void P_Add(string str_Input) { txt_new_Temp.Text += Environment.NewLine + str_Input; } private void button2_Click(object sender, EventArgs e) { ManagementObjectSearcher diskDrives = new ManagementObjectSearcher(“SELECT * FROM Win32_DiskDrive WHERE InterfaceType=’USB'”); foreach (ManagementObject diskDrive in diskDrives.Get()) { string DeviceID = diskDrive[“DeviceID”].ToString(); string DriveLetter = “”; string DriveDescription = “”; // associate physical disks with partitions ManagementObjectSearcher partitionSearcher = new ManagementObjectSearcher(String.Format( “associators of {{Win32_DiskDrive.DeviceID='{0}’}} where …

Read More »

اضافه کردن آیتم به لیست باکس در C# How might I add an item to a ListBox?

c# Shrp Programing

list.Items.add(new ListBoxItem("name", "value")); The internal (default) data structure of the ListBox is the ListBoxItem. You can choose what do display using the DisplayMember of the ListBox. List<SomeData> data = new List<SomeData>(); data.Add(new SomeData() { Value = 1, Text= "Some Text"}); data.Add(new SomeData() { Value = 2, Text = "Some Other Text"}); listBox1.DisplayMember = "Text"; listBox1.DataSource = data; When the user …

Read More »

خواندن یک فیلد فایل xml در in C#C# :: Read All rows of one field from XML

how to use XML in C#

یک کد کاربردی برای خواندن همه رکوردهای یک فیلد فایل XML در C#   XML File: ۱ گروه فنی مهندسی پرهاست http://www.ParHost.net گروه فنی مهندسی پرهاست ارائه دهنده خدمات و سرویسهای اینترنتی ۲۸۵۸ ۱ <Null> <Null> ۲ یادداشتها و چرکنویس های من http://blog.parhost.net/ یادداشتها و چرکنویس های من ، نکته ها و آموزه هایی در مورد فناوری اطلاعات ۲۹۸۹ ۱ …

Read More »

تغییر زبان اتوماتیک بصورت اتوماتیک از فارسی به انگلیسی و برعکس در نرم افزار

c# Shrp Programing

فرض کنید که دو نرم افزاری که دارید مینویسید چند تا   TextBox بر روی فرم دارید و قرار است در یکی از آنها ایمیل (انگلیسی) بنویسید و در دیگری نام خود را به صورت فارسی تایپ کنید، برای اینکه از دکمه های ترکیبی shift+Alt استفاده نکنید کافیست در رویداد Enter کنترلی که قرار است در آن فارسی تایپ شود کد …

Read More »