Ok, ill try again.....
It seems fairly simple.
I have two combo boxes in a datagrid. The datagrid is bound to a a table in
a dataset.
The two combo boxes are bound to a single data table in a different dataset.
One combo box is displaying the Employees payroll ID. The other is
displaying the Employees name.
The users are entering timesheet hours for employees. They want to be able
to select the employee by either payroll id, or employee name.
If they select a payroll id from the first combo box, I need the second
combo box to display the matching employee surname.
I cannot see anyway to do this.
I can only seem to get the selected index of the combo box being selected.
(by using the editing control event and casting the datagrid comboboxcolumn
to a combo box). However, I dont know how I can set the selected index of
the other combo box.
Can anyone help? (besides telling me to buy some third party control!)
thankyou 7 1830
Hi there,
Sounds like you've had problems getting help.
I'll try as best I can but need you to provide some more info first.
1. Windows or web application? .NET 1.1 I presume?
2. Post some code; specifically where you do your binding/fill the
combos.
If you can get a reference to the actual combobox in question, then it
should not be too hard to select the right item. But assigning the
right information to the combobox in the first place is the important
part. For example, in windows app, you can iterate through the items
collection and check each item's bound row for a match to the ID
selected in the other cbx.
Steven
Im using version 2.0
This is a windows form.
I am using the standard DatagridView. This is bound to a dataset generated
by the dataset designer.
I have gone into the designer for the DataGridView and changed the
properties of the two columns previously mentioned to combo boxes (instead of
text boxes).
On the form load, I create a dataset and use stored procedures to populate
various tables with lookup data.
I then bind the combo boxes in the datagrid to these dataset tables
eg
with DataGridCombo1
.DisplayMember = "EmpCode"
.ValueMember = "Surname"
.DataSource = dsLookups.Tables("EmplsCodeLookup")
end with
now...teh comboboxes that are embedded in the datagrid do not have the
selectedindex property available...
so, if the user selects a value in one combo box, to get the selected index
of that combo box I have to do the following
Private Sub TblTimeSheetHoursDataGridView_EditingControlShowin g(ByVal sender
As Object, ByVal e As
System.Windows.Forms.DataGridViewEditingControlSho wingEventArgs) Handles
TblTimeSheetHoursDataGridView.EditingControlShowin g
Dim combo As ComboBox = CType(e.Control, ComboBox)
If (combo IsNot Nothing) Then
Select Case TblTimeSheetHoursDataGridView.CurrentCell.ColumnIn dex
Case 2
RemoveHandler combo.SelectedIndexChanged, _
New EventHandler(AddressOf
EmplCodeComboBox_SelectedIndexChanged)
....
....
....
end sub
Which is all well and good, I now have the selected index of the combo box
the user has just selected. However, I now need to programmatically set the
index of the other combo box....
What i want to know is.....how do I do this (given that the editing control
event had to be raised to get the selected index of the other combo!!).
Surely this is possible somehow!?
Please help
Hi again,
No problems. If you can wait on the problem for another 24 hours, I
will attempt to recreate your problem at home tonight and find an
answer for you. Unfortunately I do not have 2.0 here at work (yes we
are a little behind the times).
Cheers,
Steven
Ausclad wrote:
Im using version 2.0
This is a windows form.
I am using the standard DatagridView. This is bound to a dataset generated
by the dataset designer.
I have gone into the designer for the DataGridView and changed the
properties of the two columns previously mentioned to combo boxes (instead of
text boxes).
On the form load, I create a dataset and use stored procedures to populate
various tables with lookup data.
I then bind the combo boxes in the datagrid to these dataset tables
eg
with DataGridCombo1
.DisplayMember = "EmpCode"
.ValueMember = "Surname"
.DataSource = dsLookups.Tables("EmplsCodeLookup")
end with
now...teh comboboxes that are embedded in the datagrid do not have the
selectedindex property available...
so, if the user selects a value in one combo box, to get the selected index
of that combo box I have to do the following
Private Sub TblTimeSheetHoursDataGridView_EditingControlShowin g(ByVal sender
As Object, ByVal e As
System.Windows.Forms.DataGridViewEditingControlSho wingEventArgs) Handles
TblTimeSheetHoursDataGridView.EditingControlShowin g
Dim combo As ComboBox = CType(e.Control, ComboBox)
If (combo IsNot Nothing) Then
Select Case TblTimeSheetHoursDataGridView.CurrentCell.ColumnIn dex
Case 2
RemoveHandler combo.SelectedIndexChanged, _
New EventHandler(AddressOf
EmplCodeComboBox_SelectedIndexChanged)
...
...
...
end sub
Which is all well and good, I now have the selected index of the combo box
the user has just selected. However, I now need to programmatically set the
index of the other combo box....
What i want to know is.....how do I do this (given that the editing control
event had to be raised to get the selected index of the other combo!!).
Surely this is possible somehow!?
Please help
Ausclad,
If you want help, than give correct questions, the help for a Combobox in a
DataGrid is much more work and completely different than for a DataGridView.
The way you ask your questions gives me not the right feeling to help you.
Maybe the next time, when you let us not first search to a complete
different solution just because you are no lazy to write correctly your
problem.
Just my thought,
Cor
"Ausclad" <Au*****@discussions.microsoft.comschreef in bericht
news:D6**********************************@microsof t.com...
Im using version 2.0
This is a windows form.
I am using the standard DatagridView. This is bound to a dataset
generated
by the dataset designer.
I have gone into the designer for the DataGridView and changed the
properties of the two columns previously mentioned to combo boxes (instead
of
text boxes).
On the form load, I create a dataset and use stored procedures to populate
various tables with lookup data.
I then bind the combo boxes in the datagrid to these dataset tables
eg
with DataGridCombo1
.DisplayMember = "EmpCode"
.ValueMember = "Surname"
.DataSource = dsLookups.Tables("EmplsCodeLookup")
end with
now...teh comboboxes that are embedded in the datagrid do not have the
selectedindex property available...
so, if the user selects a value in one combo box, to get the selected
index
of that combo box I have to do the following
Private Sub TblTimeSheetHoursDataGridView_EditingControlShowin g(ByVal
sender
As Object, ByVal e As
System.Windows.Forms.DataGridViewEditingControlSho wingEventArgs) Handles
TblTimeSheetHoursDataGridView.EditingControlShowin g
Dim combo As ComboBox = CType(e.Control, ComboBox)
If (combo IsNot Nothing) Then
Select Case
TblTimeSheetHoursDataGridView.CurrentCell.ColumnIn dex
Case 2
RemoveHandler combo.SelectedIndexChanged, _
New EventHandler(AddressOf
EmplCodeComboBox_SelectedIndexChanged)
...
...
...
end sub
Which is all well and good, I now have the selected index of the combo box
the user has just selected. However, I now need to programmatically set
the
index of the other combo box....
What i want to know is.....how do I do this (given that the editing
control
event had to be raised to get the selected index of the other combo!!).
Surely this is possible somehow!?
Please help
Wow Cor, I think you came in a little too strong this time.
If you want help, than give correct questions
People can't always word the question as perfectly as we would like.
That's why I asked the clarification questions. Now days, if anyone
ever asks about DataGrids, I always first check what framework version
they are running, just in case. It so happens that this time it paid
off.
I suppose I got lucky...
The way you ask your questions gives me not the right feeling to help you.
I guess thats up to you. You are well within your rights to refuse to
answer anyones questions.
Maybe the next time, when you let us not first search to a complete
different solution just because you are no lazy to write correctly your
problem.
I don't think laziness has anything to do with it in this posting. The
OP merely ommitted a single word "View" that simply happened to have a
large impact on the solution. While I concur that this can be
frustrating, I think a more educational approach for the OP is to
simply advise them of the impact of their error and the consequences.
This lets the OP have a chance at apologising for their mistake. But
coming out and attacking straight off the bat is not going to help
anyone.
Anyway, lets see if we can find an answer for him, shall we? I don't
have .NET2.0 here but I can look at it tonight if no one else can help
now...
Steven
Steven,
I do not like those people who give a lot of work, for the same case I would
have send some links for combobox datagrids and given some help. You can use
the DataGrids in any version of Net.
What is wrong to describe a question good, instead of something as.
"I have a problem with my Combo Boxes in Datagrids" Who says that it is in
this case about Comboboxes and not about a Calendar Control.
It can in my opinion not be a problem. My message was also meant to show to
others that we should not help in these cases that people don't take even
the time to put there question right, in my idea have those people not even
investigated their problems and do I completely agree what Boo often
writes..
But feel free to help.
Cor
"Steven Nagy" <le*********@hotmail.comschreef in bericht
news:11********************@i3g2000cwc.googlegroup s.com...
Wow Cor, I think you came in a little too strong this time.
>If you want help, than give correct questions
People can't always word the question as perfectly as we would like.
That's why I asked the clarification questions. Now days, if anyone
ever asks about DataGrids, I always first check what framework version
they are running, just in case. It so happens that this time it paid
off.
I suppose I got lucky...
>The way you ask your questions gives me not the right feeling to help you.
I guess thats up to you. You are well within your rights to refuse to
answer anyones questions.
>Maybe the next time, when you let us not first search to a complete different solution just because you are no lazy to write correctly your problem.
I don't think laziness has anything to do with it in this posting. The
OP merely ommitted a single word "View" that simply happened to have a
large impact on the solution. While I concur that this can be
frustrating, I think a more educational approach for the OP is to
simply advise them of the impact of their error and the consequences.
This lets the OP have a chance at apologising for their mistake. But
coming out and attacking straight off the bat is not going to help
anyone.
Anyway, lets see if we can find an answer for him, shall we? I don't
have .NET2.0 here but I can look at it tonight if no one else can help
now...
Steven
Well thanks Cor for that complete and utter gibberish.
The whole point of these forums, I thought, was for people who do not have a
complete understanding of the .net framework to seek some guidance from those
who do.
Since I am new to .net I was not aware that there was/is a datagrid and a
datagridview. Since my version only shipped with a DataGridView I (wrongly)
assumed the generic term "datagrid" was adequate. My humble apologies!
Given that I spent a good 5-6 hours attempting this task and googling to
find a solution first I think I have at least given it reasonable thought
before posting the question.
Given the way you write, there no way I could convert my question into
something you could possibly understand anyway.
Steven, thanks for being the kind of person this forum needs. I look
forward to any further help you are able to provide.
thanks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: FZ |
last post by:
Hi Gang,
I was wondering if a generous person might be able to walk me
through what I believe is a pretty simple task. I actually have
significant Access experience, but I haven't done it in...
|
by: Krisa |
last post by:
Hello all,
I just discovered something (stop me if you've heard this before....) that
was causing me a significant performance hit when opening a form with
subforms.
To speed up loading the...
|
by: Tom |
last post by:
I have some very strange issues with combo boxes on a tab control.
Here's the scenario: I have a Windows Forms form that has a tab control
on it, with two (2) tabs. Tab 2 happens to have a number...
|
by: Ausclad |
last post by:
How Would you implement this?
I have an existing Access application that needs to be converted to .net
I am restricted to use the existing database design.
One of the areas is a timesheet...
|
by: Dave |
last post by:
I wasn't sure how to search for previous posts about this, it felt
real specific. Ok so here's the database & problem:
I have 4 combo boxes: cboServer, cboPolicy, cboDB, and
cboApplication. ...
| |
by: Dave |
last post by:
I want to put the information that the user selects in my combo boxes
into a subform that lies on the same form as the combo boxes.
Thanks for your help already,
Dave
|
by: Dave |
last post by:
Hello all,
First I'd like to apologize...This post was meant to be put in my
previous post, but I tried many times without success to reply within
my previous post. Now here goes...
I have a...
|
by: Dave |
last post by:
I have 3 tables of information feeding into 4 combo boxes on my main
form (DR Form). I have as many list boxes (acting as text boxes) as
there are fields in each one of the 3 tables. Once...
|
by: someshbakliwal |
last post by:
Hi,
I have created some autopopulating combo boxes on my HTML page (script- Javascript). so these combo boxes are autopopulated with choices made in previous combo boxes.
The problem I am facing is...
|
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,...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |