Click here to Skip to main content
14,330,747 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi my codes in
form loading i change combobox values
but i want not run the combobox change codes

What I have tried:

  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
gün.Value = Date.Now.ToString("dd/MM/yyyy")
        yıl.Text = Year(Date.Now)
        ay.Text = MonthName(Month(Date.Now))



Private Sub gün_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gün.ValueChanged
       veri_cek()

   End Sub
Posted
Updated 8-Oct-19 2:17am
v2
Rate this:
Please Sign up or sign in to vote.

Solution 1

The ValueChanged-Event is allways raised if the Value changes - independant from when that happens.
But you could easyly prevent that for example with a Boolean Variable which disables the call from veri_cek when Form1_Load is running.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

You can add or remove event handler whenever you want. See:
AddHandler Statement (Visual Basic) | Microsoft Docs[^]
RemoveHandler Statement (Visual Basic) | Microsoft Docs[^]
So, change Form_Load procedure accordingly.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100