I'm trying to get a text from my ComboBox
in order to switch it, but it always returns null
. What am I doing wrong?
XAML:
<ComboBox Name="cbForms" SelectionChanged="cbForms_SelectionChanged" HorizontalAlignment="Left" Margin="10,289,0,0" VerticalAlignment="Top" Width="139">
<ComboBoxItem IsSelected="True">Polygon</ComboBoxItem>
<ComboBoxItem>Rechteck</ComboBoxItem>
<ComboBoxItem>Dreieck</ComboBoxItem>
<ComboBoxItem>Kreis</ComboBoxItem>
</ComboBox>
C# Code:
private void cbForms_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
string text = cbForms.Text;
switch (text)
{
case "Polygon":
{
commandText = "SELECT f.bezeichnung, t.X, t.Y, t.id FROM figure05 f, TABLE(SDO_UTIL.GETVERTICES(f.shape)) t";
lblAnz.Content = anzPolygon.ToString();
break;
}
Am I missing something? Thanks for any kind of help!