Results 1 to 36 of 36

Thread: A Beginners Naivety - Varaibles

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2011
    Posts
    23

    A Beginners Naivety - Varaibles

    I'm just learning WPF apps and have been looking for a good tutorial on how variables work within the WPF model, but really haven't been able to find something. Subsequently, I'm a bit stuck :S

    I feel like I'm trying to do something basic here, but maybe I'm just off my rocker. All I'm trying to do is onSelectionChanged of a dropdown, run function XXX. Function XXX, at run, populates a variables then writes the variable to a label. I'll post code snippets. But what am I missing?

    DropDown Code
    Code:
    <ComboBox Canvas.Left="223" Canvas.Top="261" Height="23" Name="userTempScale" Width="54" Background="{x:Null}" BorderBrush="#FF992907" BorderThickness="0" Foreground="#FF992907" HorizontalContentAlignment="Center">
                <ComboBoxItem Content="F" IsSelected="True" />
                <ComboBoxItem Content="C" />
                <ComboBoxItem Content="K" />
                <ComboBoxItem Content="Re" />
                <ComboBoxItem Content="Ra" />
            </ComboBox>
    Dropdown Handler Code
    Code:
        Private Sub userTempScale_SelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs) Handles userTempScale.SelectionChanged
            calculateTemps() ' Update our Temps 
        End Sub
    Function XXX code
    Code:
    Public Function calculateTemps() As Action
    Dim tempscale As String = userTempScale.SelectedItem.ToString
    If tempscale = "F" Then
    fah_label.Content = tempscale
    endif
    Like I said, pretty basic but I seem to be missing a connection between WPF and WinForms. Anyone got a wrench to smack me over the head with?
    Last edited by Hack; Feb 15th, 2011 at 01:23 PM. Reason: Fixed Code Tag

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width