473,606 Members | 2,825 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HLP: GRRR... StartUp Troubles

GRRRR... I've run across a situation in which I have NO solution. Hopefully
there is one. VB.net.

It's rather simple.

I've a ComboBox that get's populated via a Database. And I pre-select (during
Formload) the Index using SelectedIndex:

' Get User info from Data Base fill
daPickUser.Fill (dsPickUser.MAS TER_PRM_EMPLOYE E)
cmbUserName.Sel ectedIndex = cmbUserName.Fin dStringExact(st rUserID)

Now the above works just fine. It finds my strUserID (ie: FEU001 which is
Index #28) and that is what is listed in the ComboBox on startup. Great!

However, I want to use the Combobox to select another User at some time. When
I ENABLE the following Private Sub for the Combobox, I get my troubles...

My Combobox even is thus...

Private Sub cmbUserName_Sel ectedIndexChang ed(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles cmbUserName.Sel ectedIndexChang ed

dsTimberline.tb lTimeEntry.Clea r()
' Refresh the Data Grid with New User Selected
strUserID = cmbUserName.Tex t
daTimberline.Se lectCommand.Par ameters(0).Valu e = strUserID
daTimberline.Fi ll(dsTimberline .tblTimeEntry)

End Sub
What happens is that on startup, somehow the Combobox SelectedIndexCh anged
sets my Combobox Index to Zero (0)... every time. I don't want Index of 0.
But the listing of what is the Index number of my strUserID.

How can I prevent the cmbUserName_Sel ectedIndexChang ed from being triggered
during startup???

Regards,

Bruce
Jul 21 '05 #1
3 1436
On 2003-10-23, Mr B <No*****@addres s.not> wrote:
GRRRR... I've run across a situation in which I have NO solution. Hopefully
there is one. VB.net.

It's rather simple.

I've a ComboBox that get's populated via a Database. And I pre-select (during
Formload) the Index using SelectedIndex:

' Get User info from Data Base fill
daPickUser.Fill (dsPickUser.MAS TER_PRM_EMPLOYE E)
cmbUserName.Sel ectedIndex = cmbUserName.Fin dStringExact(st rUserID)

Now the above works just fine. It finds my strUserID (ie: FEU001 which is
Index #28) and that is what is listed in the ComboBox on startup. Great!

However, I want to use the Combobox to select another User at some time. When
I ENABLE the following Private Sub for the Combobox, I get my troubles...

My Combobox even is thus...

Private Sub cmbUserName_Sel ectedIndexChang ed(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles cmbUserName.Sel ectedIndexChang ed

dsTimberline.tb lTimeEntry.Clea r()
' Refresh the Data Grid with New User Selected
strUserID = cmbUserName.Tex t
daTimberline.Se lectCommand.Par ameters(0).Valu e = strUserID
daTimberline.Fi ll(dsTimberline .tblTimeEntry)

End Sub
What happens is that on startup, somehow the Combobox SelectedIndexCh anged
sets my Combobox Index to Zero (0)... every time. I don't want Index of 0.
But the listing of what is the Index number of my strUserID.

How can I prevent the cmbUserName_Sel ectedIndexChang ed from being triggered
during startup???

Regards,

Bruce


Bruce...

A possilbe solution to this is to remove the handles clause from your
event handler. Then AFTER you fill the combobox, you can associate the
event with the combobox using AddHandler:

Private Sub Form_Load(...) Handles...

' Fill Your Combo Box

' Add your handler dynamcially
AddHandler cmbUserName.Sel ectedIndexChang ed, AddressOf
cmbUserName_Sel ectedIndexChang ed
End Sub
' then change the sig of the event to:
Private Sub cmbUserName_Sel ectedIndexChang ed( _
ByVal sender As System.Object, ByVal e As System.EventArg s)

'Do Cool Stuff!
End Sub

HTH
--
Tom Shelton
MVP [Visual Basic]
Jul 21 '05 #2
With Deft Fingers, Tom Shelton <to*@mtogden.co m> wrote:
On 2003-10-23, Mr B <No*****@addres s.not> wrote:
GRRRR... I've run across a situation in which I have NO solution. Hopefully
there is one. VB.net.

A possilbe solution to this is to remove the handles clause from your
event handler. Then AFTER you fill the combobox, you can associate the
event with the combobox using AddHandler:


Thanks Tom... I'll try that!

Regards,

Bruce
Jul 21 '05 #3
With Deft Fingers, Tom Shelton <to*@mtogden.co m> wrote:
A possilbe solution to this is to remove the handles clause from your
event handler. Then AFTER you fill the combobox, you can associate the
event with the combobox using AddHandler:


Sweet!!! Worked GREAT! Many Thanks!

Bruce
Jul 21 '05 #4

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

Similar topics

3
1098
by: Mr. B | last post by:
GRRRR... I've run across a situation in which I have NO solution. Hopefully there is one. VB.net. It's rather simple. I've a ComboBox that get's populated via a Database. And I pre-select (during Formload) the Index using SelectedIndex: ' Get User info from Data Base fill daPickUser.Fill(dsPickUser.MASTER_PRM_EMPLOYEE)
3
271
by: Mr. B | last post by:
GRRRR... I've run across a situation in which I have NO solution. Hopefully there is one. VB.net. It's rather simple. I've a ComboBox that get's populated via a Database. And I pre-select (during Formload) the Index using SelectedIndex: ' Get User info from Data Base fill daPickUser.Fill(dsPickUser.MASTER_PRM_EMPLOYEE)
0
1308
by: Madmax | last post by:
I am trying to use the .hlp file (an old help from for an existing app) in my application .Although the file shows up but it does not open the desired search string this is what I am doing string strHelp = C:\myfolder\ABC.HLP"; //its a hlp file Help.ShowHelp(this, strHelp,"Glossary");
2
1763
by: HornyAZNBoy | last post by:
I've just wrote a hlp file to a program I just completed. Now I want to open that hlp file with a command on my program. I've tried using the Call Shell(C:/WINDOWS/Cris/desktop/MS Skill Book/Skill Book.exe) method and it works fine, but now I want to send it to a friend and I want him to be able to open that hlp file, but his computer name isn't Cris. Any suggestions? I've also tried this method and it is not working. Command1_Click()...
0
8045
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7981
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8467
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8127
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6803
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5994
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5470
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3952
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.