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

Recommended Answers

All 7 Replies

my advice is to step through the code and figure out what your "LevelofAccessTextBox.Text" equals. Then come back here to update your issue.

it should be equal to the level of access that is in the LevelofAccessTextBox.Text

LevelofAccessTextBox.Text is equal to the level of access of the users who login

You forgot to add: Is your comboBox databound?

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

Y use a variable??? u could have also done without a variable...just suggested...

TextBox9.Text = login.LevelofAccessTextBox.Text
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.