How to extract specific info from a space/cell from access into VB?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • david quesada
    New Member
    • Feb 2011
    • 1

    How to extract specific info from a space/cell from access into VB?

    alright, hey everyone, I'm new here, and also new to VB, I'm trying to do an application that needs to generate 10 random names, I was looking for a way of maybe putting names in a access database, and extracting the info in the space/cell randomly and returning it into the label, but I didn't found out how 2 do it, so I did it the "hard way"
    here's some code of the application that i wrote, (I'm not putting the whole code because it's a lot)

    Code:
      If RadioButton1.Checked = False And RadioButton2.Checked = False Then
                ErrorProvider1.SetError(Button1, "SELECCIONE EL GENERO PARA GENERAR NOMBRES")
            Else
    
                Dim r As New Random
                Dim num_al As Integer
                num_al = r.Next(0, 4)
    
    
                If RadioButton1.Checked = True And RadioButton2.Checked = False Then
                    Select Case num_al
                        Case 0
                            Label4.Text = "Woody"
                        Case 1
                            Label4.Text = "Buzz"
                        Case 2
                            Label4.Text = "Chadd"
                        Case 3
                            Label4.Text = "Mark"
                        Case 4
                            Label4.Text = "Joe"
    
    
                    End Select
    
                ElseIf RadioButton2.Checked = True And RadioButton1.Checked = False Then
    
                    Select Case num_al
                        Case 0
                            Label4.Text = "Alisson"
                        Case 1
                            Label4.Text = "Luz"
                        Case 2
                            Label4.Text = "Karen"
                        Case 3
                            Label4.Text = "Lilliam"
                        Case 4
                            Label4.Text = "Andrea"
    
                    End Select
    the bad thing of the way I did it. is that is not random at all, lol, sometimes i have to click up to 10 times to get a different numbers,
    any ideas, or help would be appreciated
    PS had to delete a lot of code
Working...