hi for my project what i am trying to do is:
i have two listboxes and in between the two boxes i have two buttons.
Btn1 is to send data from listbox1 to listbox 2
Btn2 is to send data from listbox2 to listbox1
below is my code could you please suggest improvements help me improve the method i am using thanks
Private Sub m_buttonAddUserRole_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles m_buttonAddUserRole.Click
connecta()
End Sub
Sub connecta()
acsconn.ConnectionString = "Provider=Microsoft.jet.oledb.4.0;data source=C:\Users\HP Sajad\Documents\Visual Studio 2010\Projects\login1\login1\security.mdb"
acsconn.Open()
If acsconn.State = ConnectionState.Open Then
End If
MsgBox("Connected")
Dim roleIndex As Integer = ListBox1.SelectedIndex
If (roleIndex = -1) Then
Return
End If
' Get the current user index.
Dim userIndex As Integer = ListBox2.SelectedIndex
' Should we ignore the the event?
If (userIndex = -1) Then
Return
End If
' Get the identifiers.
Dim userID As Integer = CType(ListBox1.SelectedItem, Int32)
Dim rightID As Integer = CType(ListBox2.SelectedItem, Int32)
' Search for an existing row.
Dim rows As DataRow() = "Select right_id from cg_security_role_right where = '" & rightID & "' AND user_id = '" & userID & ;
' Is there already an association
If (rows.Length > 0) Then
Return
End If
End Sub