0

please help me.. i keep searching anywhere but find no answer

i want to set the default value of a combobox in my edit account module based on the levelofaccesstextbox in my login module but my codes doesn't work

here's my code:
Private Sub editaccount_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If login.LevelofAccessTextBox.Text = "Student" Then
With Me.ComboBox1.Items
.Add("Student")
End With
End If
End Sub

Edited by jhedonghae: to clarify

4
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by jhedonghae
0

When this code executes is your login form open? I'm guessing that you are populating the LevelofAccessTextBox after verifying login details. Wouldn't it be easier to use a global var and be done with it?

2

Check your draw mode property of combobox if its not normal ur code will not work.

0

actually my problem is now solved thanks for everyone's help i used this code instead

Private Sub editaccount_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
Dim x1 As String
x1 = login.LevelofAccessTextBox.Text
TextBox9.Text = x1
End Sub

I replace combobox with textbox

This question has already been answered. 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.