0

hello i'm doing a project i use visual basic 2010 i have an issue with the select case it suppose to be when you press the 2 and the 3 it gives you all the names start with (a&d) (a&e) (a&f) or (b&d) (b&e)...etc. it works fine just the error keep showing in the select case please help me and any comment will be appreciated this is the code and the GUI of it

screen21

Here is the code

`Public Class Form1

Dim check As Boolean = True
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
    ListBox1.Text = ""
    MaskedTextBox1.Text = ""
    MaskedTextBox2.Text = ""
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

    If check = True Then
        MaskedTextBox1.Text = "2"
    End If

    If check = False Then
        MaskedTextBox2.Text = "2"
    End If

    check = False
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    If check = True Then
        MaskedTextBox1.Text = "3"
    End If

    If check = False Then
        MaskedTextBox2.Text = "3"
    End If

    check = False
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    If check = True Then
        MaskedTextBox1.Text = "4"
    End If

    If check = False Then
        MaskedTextBox2.Text = "4"
    End If

    check = False
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
    If check = True Then
        MaskedTextBox1.Text = "5"
    End If

    If check = False Then
        MaskedTextBox2.Text = "5"
    End If

    check = False
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    If check = True Then
        MaskedTextBox1.Text = "6"
    End If

    If check = False Then
        MaskedTextBox2.Text = "6"
    End If

    check = False
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
    If check = True Then
        MaskedTextBox1.Text = "7"
    End If

    If check = False Then
        MaskedTextBox2.Text = "7"
    End If

    check = False
End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
    If check = True Then
        MaskedTextBox1.Text = "8"
    End If

    If check = False Then
        MaskedTextBox2.Text = "8"
    End If

    check = False
End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
    If check = True Then
        MaskedTextBox1.Text = "9"
    End If

    If check = False Then
        MaskedTextBox2.Text = "9"
    End If

    check = False
End Sub

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
    If check = True Then
        MaskedTextBox1.Text = "0"
    End If

    If check = False Then
        MaskedTextBox2.Text = "0"
    End If

    check = False
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim button As DialogResult
    button = MessageBox.Show _
    ("you entered a wrong number")

    If button = Windows.Forms.DialogResult.Yes Then
        Me.Close()
    Else
        'Do Nothing    
    End If

End Sub

Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
    Dim button As DialogResult
    button = MessageBox.Show _
    ("you entered a wrong number")

    If button = Windows.Forms.DialogResult.Yes Then
        Me.Close()
    Else
        'Do Nothing    
    End If
End Sub

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
    Dim button As DialogResult
    button = MessageBox.Show _
    ("you entered a wrong number")

    If button = Windows.Forms.DialogResult.Yes Then
        Me.Close()
    Else
        'Do Nothing    
    End If
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
Structure info

    Dim Firstname As String
    Dim Secondname As Integer
    Dim Phonenumber As Integer
    Dim email As String

End Structure






Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
    Dim ar() As String = IO.File.ReadAllLines("info.txt")
    Dim query = From person In ar Select person

    For Each person As String In query
        ListBox1.Items.Add(person)
        ListBox1.Items.Add("")
    Next
End Sub

`End Class

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by tinstaafl
0

Your code doesn't look to bad. However I don't see any select case statement. If you mean the query statement with select in it, what error do you get?

On another matter you might want to take a look at this post about handling multiple controls with one handler( control array). It will simplify your code tremendously.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.