473,387 Members | 1,592 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.

Combobox and DataSource

I'm thinking this shouldn't be hard...but I can't seem to grasp what I need
to do here. I have a datagrid on my form (datasource=dtUsers). This
datagrid displays three fields username, password, level. In the database I
have the level as a 1 character field (1,2,3...). The data displays
properly in the datagrid.
I have a textbox below the datagrid. I have put this code in the load event
of the form:
Me.txtUsername.DataBindings.Add("Text", dtUsers, "username")
The textbox works as it should...as I click on different users in the grid
the username changes in the textbox.

So, here's my question.
I want to create a combobox that will display the level...but I want to use
1=User, 2=Admin, etc.
I'm trying to figure out how to do this. I created a DT to match up the
values, but I'm not sure how to bind them and so on...

Can anyone help point me in the right direction?

-bruce duncan

Nov 21 '05 #1
3 1298
Bruce,

There is on difference with the dataset you have as well to tell what is the
displaymember and what is the valuemember.

cmb.displaymemer = "mycolumn1"
cmb.valuemember = "mycolumn2"

I hope this helps,

Cor
Nov 21 '05 #2
Cor,
Maybe I didn't explain my question very well...or I don't understand your
answer. Here's my DT:
dtUsers with fields username,password,level
examples:
bob,xx,1
jane,qa,2
This is what I want to display in the datagrid...yea...that's simple.
The hard part....I want the combobox (located just below the datagrid) to
display "administrator" when I'm on the record for "bob" and I want it to
display "user" when I'm on the record for "jane".
I was thinking I need to create another datatable with two fields
(val,display) and it would look something like:
1,"administrator"
2,"user"
etc
I can create this datatable and display it...but when I change the cell on
the datagrid I want the value to change in the combobox..

Any more insight?

-bruce

"Cor Ligthert" <no************@planet.nl> wrote in message
news:Oa*************@TK2MSFTNGP10.phx.gbl...
Bruce,

There is on difference with the dataset you have as well to tell what is the displaymember and what is the valuemember.

cmb.displaymemer = "mycolumn1"
cmb.valuemember = "mycolumn2"

I hope this helps,

Cor

Nov 21 '05 #3
Bruce,

Outside is not so clever, I thought that I have once made a sample for that.
However why not inside.

In this message is the sample that as far as I remember me does what you
ask.

http://groups-beta.google.com/group/...7e70ca7e12ff40

I am not sure, however try it yourself, because here it is late.

Cor
Nov 21 '05 #4

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

Similar topics

0
by: CalPARK InterNetStation | last post by:
Could anyone explain why the difference of behavior betweein Case1 and Case2 occurs? Microsoft Visual C#.NET 55607-652-0000007-18218 Windows Forms Application 1. put a TabControl on a Form...
3
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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.