Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# combobox selectedvalue

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    ComboBox cmb = (ComboBox)sender;
    int selectedIndex = cmb.SelectedIndex;
    int selectedValue = (int)cmb.SelectedValue;

    ComboboxItem selectedCar = (ComboboxItem)cmb.SelectedItem;
    MessageBox.Show(String.Format("Index: [{0}] CarName={1}; Value={2}", selectedIndex, selectedCar.Text, selecteVal));        
}
Comment

c# combobox selected item

string getText = comboBox.SelectedItem.ToString();
Comment

combobox selected item c#

int comboBox_selectedIndex = comboBoxName.SelectedIndex; //item index
string comboBox_selectedContent = comboBoxName.SelectedItem; //item name
// Unselected combo box returns null. Be careful to catch errors.
Comment

c# combobox selectedvalue


private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    ComboBox cmb = (ComboBox)sender;
    int selectedIndex = cmb.SelectedIndex;
    int selectedValue = (int)cmb.SelectedValue;

    ComboboxItem selectedCar = (ComboboxItem)cmb.SelectedItem;
    MessageBox.Show(String.Format("Index: [{0}] CarName={1}; Value={2}", selectedIndex, selectedCar.Text, selecteVal));        
}

Comment

PREVIOUS NEXT
Code Example
Csharp :: void update 
Csharp :: Compare trees 
Csharp :: c# find one object in list where 
Csharp :: c# string is not null or empty 
Csharp :: c# relative path to project folder 
Csharp :: C# .net core convert to int round up 
Csharp :: new color unity 
Csharp :: get query string parameter from string value c# 
Csharp :: c# send email 
Csharp :: casting string to enum type 
Csharp :: c# how to refresh your binding source 
Csharp :: how to get the current time in milliseconds .net 
Csharp :: csproj include folder and files 
Csharp :: c# read binary file 
Csharp :: c# mailmessage set sender name 
Csharp :: triangle minimum path sum c# 
Csharp :: convert array object to int[] c# 
Csharp :: c# map 
Csharp :: reverse a string in c# 
Csharp :: c# do while loop 
Csharp :: c# file directory selection 
Csharp :: list all files in directory and subdirectories c# 
Csharp :: unity time deltatime 
Csharp :: linq query select top 1 c# 
Csharp :: xamarin forms open new page on button click 
Csharp :: unity editor dropdown 
Csharp :: how to remove space between string in c# 
Csharp :: what does static mean in c# 
Csharp :: how to store an array inside an array c# 
Csharp :: unity play sound effect 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =