I have gone through the articles appeared in this forum on the above Area.But it didn't helped me much,As I am new to VB.net.
In VB6 I have the following code and it works well.
Private Sub CmbBank_GotFocus()
CmbBank.BackColor = vbYellow
LblMsg = "Select Bank"
Dim A, B, C As Integer
CmbBank.Clear
CmbBank.Text = "SELECT BANK NAME"
Set RS = New ADODB.Recordset
If RS.State = adStateOpen Then RS.Close
RS.Open "SELECT * FROM Receipts", CN, adOpenStatic, adLockOptimistic
If TxtMode = "A" Then
Do Until RS.EOF
CmbBank.AddItem RS!Bank
RS.MoveNext
Loop
Else
Do Until RS.EOF
A = Len(Left(RS!Bank, 25))
A = 25 - A
B = Len(Left(RS!Acno, 16))
B = 16 - B
C = Len(Left(RS!Amount, 10))
C = 10 - C
CmbBank.AddItem RS!Bank & Space(A) & Space(1) & (RS!Acno) & Space(B) & Space(1) & (RS!Amount)
RS.MoveNext
Loop
End If
End Sub
The combo box is filled with three columns of the Table-Bank,Acno,Amount
When it comes to VB.net What will be the code?
Any one please help me..