hi im having trouble with lstout
i have attached ss of result,
i dont want System.Windows.Forms.Button,Text appear
and also when i click one of seats which are A1~D10
let's say if i clicked D3 it pops "Enter your Name" msgbox so after i enter it
it doesn't show output on lstout it only shows 33 D3
there should be Name right after D3
what do i have to fix it,
im getting confused what i typed, i'd say it is messy
cuz of array.
also if you "A" letter in msgbox
it displays A all over after : **(A1~D10)
Public Class frmAirLine
Dim OS As New Font("", 18, FontStyle.Strikeout)
Dim newFont As New Font("", 18, FontStyle.Bold)
Dim seat(40) As Button
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
seat(1) = btna1
seat(2) = btna2
seat(3) = btna3
seat(4) = btna4
seat(5) = btna5
seat(6) = btna6
seat(7) = btna7
seat(8) = btna8
seat(9) = btna9
seat(10) = btna10
seat(11) = btnB1
seat(12) = btnB2
seat(13) = btnB3
seat(14) = btnB4
seat(15) = btnB5
seat(16) = btnB6
seat(17) = btnB7
seat(18) = btnB8
seat(19) = btnB9
seat(20) = btnB10
seat(21) = btnc1
seat(22) = btnc2
seat(23) = btnc3
seat(24) = btnc4
seat(25) = btnc5
seat(26) = btnc6
seat(27) = btnc7
seat(28) = btnc8
seat(29) = btnc9
seat(30) = btnc10
seat(31) = btnD1
seat(32) = btnD2
seat(33) = btnD3
seat(34) = btnD4
seat(35) = btnD5
seat(36) = btnD6
seat(37) = btnD7
seat(38) = btnD8
seat(39) = btnD9
seat(40) = btnD10
showall()
For i = 1 To 40
seat(i).BackColor = Color.White
AddHandler seat(i).Click, AddressOf Button_Click
seat(i).Show()
seat(i).Size = New Size(80, 40)
seat(i).Font = newFont
Next
End Sub
Dim nam As String
Public Sub Button_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim btn As Button = CType(sender, Button)
nam = InputBox("Enter Your Name", "Passenger Name", )
If nam.Length <= 1 Then
MsgBox("Please Enter Your Name")
ElseIf nam.Length >= 2 Then
MsgBox("Hi, ( " + LTrim$(nam) + " ) you have completed reservation")
btn.Enabled = False
If btn.Enabled = False Then
btn.Font = OS
End If
Exit Sub
End If
showall()
End Sub
Sub showall()
Dim fmtstr0 As String = "{0,-3}{1,3}{2,3}{3,3}{4,3}"
Dim fmtstr1 As String = "{0,-3}{1,5}{2,10}"
lstout.Items.Clear()
lstout.Items.Add(String.Format(fmtstr0, "", "a", "c", "d", "b"))
For i As Integer = 1 To 40
lstout.Items.Add(String.Format(fmtstr1, i, seat(i), nam))
Next i
End Sub
End Class