473,387 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

help, TabControl1_SelectedIndexChanged fires on form initialize

Hello all. Please please help me come up with a solution to this
problem.
Here it goes-
--- code snipit---

'TabControl1
'
Me.TabControl1.Anchor = System.Windows.Forms.AnchorStyles.Left
Me.TabControl1.Controls.AddRange(New
System.Windows.Forms.Control()
{Me.TabPage1, Me.TabPage2, Me.TabPage3})
Me.TabControl1.Enabled = False
Me.TabControl1.Location = New System.Drawing.Point(0, 40)
Me.TabControl1.Name = "TabControl1"
Offending Line---->>>>> Me.TabControl1.SelectedIndex = 0
Me.TabControl1.Size = New System.Drawing.Size(640, 384)
Me.TabControl1.TabIndex = 3
---------------------------------
When this control gets initialized it sets the selected index to 0,
thus firing the following code-

----------------
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged

Do your stuff here...

End Sub
------------

I do NOT want anything to happen when the form is initializing. How
can I catch this or stop it from happening?
I've tried to delete the offending line, but it comes back :o) ...
Any ideas?
To recreate,
Add tabcontrol to form, add a page or more to the tabcontrol.
Set the selected index changed event.
Run :o)

THANKS!
Jeff C.
Nov 20 '05 #1
2 3616
\\\
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged

Static FirstChange as Boolean = True
If FirstChange = True then
FirstChange=False
Return
End If
Do your stuff here...

End Sub
///

"Jeff C" <uj*****@mail.crk.umn.edu> wrote in message
news:ea**************************@posting.google.c om...
Hello all. Please please help me come up with a solution to this
problem.
Here it goes-
--- code snipit---

'TabControl1
'
Me.TabControl1.Anchor = System.Windows.Forms.AnchorStyles.Left
Me.TabControl1.Controls.AddRange(New
System.Windows.Forms.Control()
{Me.TabPage1, Me.TabPage2, Me.TabPage3})
Me.TabControl1.Enabled = False
Me.TabControl1.Location = New System.Drawing.Point(0, 40)
Me.TabControl1.Name = "TabControl1"
Offending Line---->>>>> Me.TabControl1.SelectedIndex = 0
Me.TabControl1.Size = New System.Drawing.Size(640, 384)
Me.TabControl1.TabIndex = 3
---------------------------------
When this control gets initialized it sets the selected index to 0,
thus firing the following code-

----------------
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged

Do your stuff here...

End Sub
------------

I do NOT want anything to happen when the form is initializing. How
can I catch this or stop it from happening?
I've tried to delete the offending line, but it comes back :o) ...
Any ideas?
To recreate,
Add tabcontrol to form, add a page or more to the tabcontrol.
Set the selected index changed event.
Run :o)

THANKS!
Jeff C.

Nov 20 '05 #2
Tricky tricky tricky :o)
Thanks,
I'll have to remember that loop with the static declaration.

Thank you very!!! much
Jeff

"Mick Doherty" <EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in message news:<ub**************@tk2msftngp13.phx.gbl>...
\\\
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged

Static FirstChange as Boolean = True
If FirstChange = True then
FirstChange=False
Return
End If
Do your stuff here...

End Sub
///

"Jeff C" <uj*****@mail.crk.umn.edu> wrote in message
news:ea**************************@posting.google.c om...
Hello all. Please please help me come up with a solution to this
problem.
Here it goes-
--- code snipit---

'TabControl1
'
Me.TabControl1.Anchor = System.Windows.Forms.AnchorStyles.Left
Me.TabControl1.Controls.AddRange(New
System.Windows.Forms.Control()
{Me.TabPage1, Me.TabPage2, Me.TabPage3})
Me.TabControl1.Enabled = False
Me.TabControl1.Location = New System.Drawing.Point(0, 40)
Me.TabControl1.Name = "TabControl1"
Offending Line---->>>>> Me.TabControl1.SelectedIndex = 0
Me.TabControl1.Size = New System.Drawing.Size(640, 384)
Me.TabControl1.TabIndex = 3
---------------------------------
When this control gets initialized it sets the selected index to 0,
thus firing the following code-

----------------
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged

Do your stuff here...

End Sub
------------

I do NOT want anything to happen when the form is initializing. How
can I catch this or stop it from happening?
I've tried to delete the offending line, but it comes back :o) ...
Any ideas?
To recreate,
Add tabcontrol to form, add a page or more to the tabcontrol.
Set the selected index changed event.
Run :o)

THANKS!
Jeff C.

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Pierre | last post by:
Hi, I create an dynamic command button like that: buttonCmd= New Button buttonCmd.ID = "IDBTN1" buttonCmd.Text = "Test" AddHandler buttonCmd.Click, AddressOf MessageClick I have this click...
3
by: cdj | last post by:
Hi all, I've got a tabControl, initially with one tabPage, along with two buttons, one to add another tabPage, and one to delete the current (selected) tabPage. On each tabPage, when it is...
9
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null;...
19
by: Heidi Hundåla | last post by:
Hi ! I have a Wep App in C#. Page_Unload fires after Page_Load, and it seems totally unreasonable when you want to use this event when you _leave_ the page. In my project we wanted to use...
1
by: Viktor Popov | last post by:
Hi , I have a form in which I show UserInfo from the DataBase using Stored Procedure and I populate 5 TextBox controls with this information in this way: private void Page_Load(object sender,...
16
by: Allen | last post by:
I have a class that returns an arraylist. How do I fill a list box from what is returned? It returns customers which is a arraylist but I cant seem to get the stuff to fill a list box. I just...
2
by: Hexman | last post by:
Off on another journey through vb.net. What I want to do now is have a tab-control with 1 to 8 tab-pages for categories. I've read where there is not a hide method so I guess I'll have to...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
3
by: Robert Dufour | last post by:
I am trying to localize a very simple web site (english and french) I have a master page and one content page for now. On the master page I have placed a Localize control On the content page I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.