Author Topic: .Net ComboBox  (Read 1832 times)

0 Members and 1 Guest are viewing this topic.

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
.Net ComboBox
« on: August 29, 2009, 02:34:42 PM »
It's been a while... I am hoping that someone may be able to help me out a bit here with a ComboBox in VB.Net.

I have created a form on which I have a ListBox, ComboBox, and two Buttons (See pics...). I had the program to where it would create any of the selected dimension styles (ie Test 1), but now I am trying to add a ComboBox into the mix to allow the user to select a preferred scale, but I am having an issue taking the selected value of the ComboBox and getting it to the location of where I need to have the value. Currently I have the following Private Sub:

Code: [Select]
Private Sub adsc_comboboxd_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles adsc_comboboxd.SelectedIndexChanged
        Dim adsc_usrdimscl As String = adsc_comboboxd.SelectedItem.ToString(Nothing)
        If adsc_comboboxd.SelectedValue = True Then
            If adsc_usrdimscl = "1 Scale" Then
                Dim adsc_dimscale As Double = "1"
            ElseIf adsc_usrdimscl = "5 Scale" Then
                Dim adsc_dimscale As Double = "5"
            ElseIf adsc_usrdimscl = "10 Scale" Then
                Dim adsc_dimscale As Double = "10"
            ElseIf adsc_usrdimscl = "20 Scale" Then
                Dim adsc_dimscale As Double = "20"
            ElseIf adsc_usrdimscl = "30 Scale" Then
                Dim adsc_dimscale As Double = "30"
            End If
        End If
    End Sub

But I am having the issue of taking the adsc_dimscale that I have created and passing it over to another Private sub in which I am actually creating the dimension styles. For example, when the user right-clicks on an item and selects create, it would go to the following code, and it would actually have adsc_dimscale as opposed to the "30" that is there currently:

Code: [Select]
1. Private Sub CreateToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateToolStripMenuItem.Click
2.         For Each itm In adsc_listboxd.SelectedItems()
3.             If itm = "Test 1" Then
4.                 adsc_initdim("Test1", "30") 'Needs to be adsc_initdim("Test1", adsc_dimscale)
5.             End If
6.         Next
7.     End Sub

Any ideas on how I can get this to work right? This is actually my first entire project in VB.Net, so I am trying to push the functionality and my coding.
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
Re: .Net ComboBox
« Reply #1 on: August 30, 2009, 01:51:10 AM »
Nevermind... I basically combined the two in a sense and was able to get it working. Trial and error proves handy once again.
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017