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 :: C# decimal with two places store as string with two places 
Csharp :: c# list string return concatenate 
Csharp :: serilog set log level 
Csharp :: c# mathf.ceiling 
Csharp :: c# bitmap to byte array 
Csharp :: c# find largest number in list 
Csharp :: get enum value from display name c# 
Csharp :: replace index in string c# 
Csharp :: unity editor dropdown 
Csharp :: unity pick random number 
Csharp :: scenemanager.loadscene 
Csharp :: get device connected to player input unity 
Csharp :: how to check if file contains image c# 
Csharp :: press key run code unity c# 
Csharp :: unity round float to nearest 10 
Csharp :: process.start web 
Csharp :: c# datagridview hide row selector 
Csharp :: badlion 
Csharp :: binary search c# 
Csharp :: how to look around with mouse in unity 
Csharp :: c# list audio devices 
Csharp :: how to get specific length of row in matrix c# 
Csharp :: dictionary order by value c# 
Csharp :: change color of object unity 
Csharp :: Convert DataTable to Dictionary in C# 
Csharp :: csharp read input from console as array 
Csharp :: how use vue createApp 
Csharp :: c# remove char from string 
Csharp :: c# file read 
Csharp :: check an enum containa an int or not in C# 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =