1
Answer

convert an ascii string number to a decimal number ?

jhu jkh

jhu jkh

15y
3.7k
1
Hi all, From a UART connection I´m getting the following string "/XCC0001011111111111" and i need to discard the "/XCC00" part and convert the ascii code "01011111111111" to a dicimal or hex number. But i don´t know how to do this - so please help me :-)
Answers (1)
0
Nafihudheen KT

Nafihudheen KT

NA 43 66.6k 13y
Thanks for the replay this is very use full tip, but I have to give the ValueMember as "client_id" because I am saving the combobox selected value, means just saving the "client_id" to the database
0
Vulpes

Vulpes

NA 98.3k 1.5m 13y
If you want to use a standard ComboBox rather than the custom one which Pritish appears to be using, then you'll need to create a List<string> where each item in the List combines the two fields you want to use for a particular row. Something like the following if the ID is always of a constant width:

   List<string> list = new List<string>();

   foreach(DataRow row in dt.Rows)
   {
       list.Add(String.Format("{0} {1}", row["client_id"], row["client_name"]);
   }

   comboName.DataSource = list;
   // no need to set DisplayMember and ValueMember properties  

To get the columns to line up properly, you'll also need to use a fixed-width font such as Consolas.
0
Pritish Deshmukh

Pritish Deshmukh

NA 195 90.5k 13y
protected override void OnDropDown(System.EventArgs e){
Form parent = this.FindForm();
if(this.dataTable != null || this.dataRows!= null){
MultiColumnComboPopup popup = new
MultiColumnComboPopup(this.dataTable,
ref this.selectedRow,columnsToDisplay);
popup.AfterRowSelectEvent+=
new AfterRowSelectEventHandler
(MultiColumnComboBox_AfterSelectEvent);
popup.Location = new Point(parent.Left +
this.Left + 4 ,parent.Top +
this.Bottom + this.Height);
popup.Show();

=====

multiColumnComboBox1.Table = dtable;//DataTable
//Column to display after selection
multiColumnComboBox1.DisplayMember = "Band";
multiColumnComboBox1.ColumnsToDisplay = new
string[]{"Band","Song","Album"};//columns to display
//in the dropdown grid