Click here to Skip to main content
15,915,019 members
Home / Discussions / C#
   

C#

 
QuestionCAML query for a SQL statement [modified] Pin
Red October 729-Dec-08 17:30
Red October 729-Dec-08 17:30 
QuestionXmlNode? Pin
dec8229-Dec-08 15:06
dec8229-Dec-08 15:06 
AnswerRe: XmlNode? Pin
Colin Angus Mackay29-Dec-08 15:09
Colin Angus Mackay29-Dec-08 15:09 
AnswerRe: XmlNode? Pin
dec8229-Dec-08 15:27
dec8229-Dec-08 15:27 
GeneralRe: XmlNode? Pin
Colin Angus Mackay29-Dec-08 15:32
Colin Angus Mackay29-Dec-08 15:32 
GeneralRe: XmlNode? Pin
vaghelabhavesh29-Dec-08 16:49
vaghelabhavesh29-Dec-08 16:49 
QuestionCubes Intersection Pin
Danimismo29-Dec-08 12:46
Danimismo29-Dec-08 12:46 
QuestionSaving hidden panel contents to an image - GDI+ Pin
eliohim200529-Dec-08 11:14
eliohim200529-Dec-08 11:14 
AnswerRe: Saving hidden panel contents to an image - GDI+ Pin
Dragonfly_Lee29-Dec-08 15:14
Dragonfly_Lee29-Dec-08 15:14 
GeneralRe: Saving hidden panel contents to an image - GDI+ Pin
eliohim200530-Dec-08 6:59
eliohim200530-Dec-08 6:59 
GeneralRe: Saving hidden panel contents to an image - GDI+ Pin
Dragonfly_Lee30-Dec-08 21:08
Dragonfly_Lee30-Dec-08 21:08 
QuestionDataGridView - Sorting [modified] Pin
myNameIsRon29-Dec-08 9:59
myNameIsRon29-Dec-08 9:59 
QuestionGettind ID after a TableAdapter Update Pin
kensai29-Dec-08 8:31
kensai29-Dec-08 8:31 
QuestionCreate Sql server alias - Remote connection Pin
calanit29-Dec-08 7:01
calanit29-Dec-08 7:01 
AnswerRe: Create Sql server alias - Remote connection Pin
Colin Angus Mackay29-Dec-08 7:17
Colin Angus Mackay29-Dec-08 7:17 
JokeRe: Create Sql server alias - Remote connection Pin
Pete O'Hanlon29-Dec-08 9:46
mvePete O'Hanlon29-Dec-08 9:46 
GeneralRe: Create Sql server alias - Remote connection Pin
calanit29-Dec-08 10:09
calanit29-Dec-08 10:09 
AnswerRe: Create Sql server alias - Remote connection Pin
Wendelius29-Dec-08 8:36
mentorWendelius29-Dec-08 8:36 
GeneralRe: Create Sql server alias - Remote connection Pin
calanit29-Dec-08 10:12
calanit29-Dec-08 10:12 
GeneralRe: Create Sql server alias - Remote connection Pin
Wendelius29-Dec-08 10:17
mentorWendelius29-Dec-08 10:17 
QuestionDataGridView with ComboBox. Need help Pin
aerinai29-Dec-08 6:26
aerinai29-Dec-08 6:26 
I have been wracking my brain for hours on this problem.

I have a DataGridView object that has a DataGridViewComboBoxColumn inside of it. The combo box displays fine and is populated from an Access database. The column has the Primary key mapped to the ValueMember variable and the column 'Type' is mapped to DisplayMember.

What I need is for each of these combo boxes to have their selected index (I think it is the Value property under DataGridViewComboBoxCell, but I'm pulling at straws at this point) be populated from another table. This took me about 6 seconds in Access. My problem is I cannot even find a way to access the Value/SelectedIndex of the Combobox once I place it in the DataGridView.

If anyone could help me out I'd greatly appreciate it.

Here is the code:
//Connection string to DB.
OleDbConnection dbCon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"" + "NGDemoSetup.mdb" + "\"");

//Dataset for majority of data
DataSet ds = new DataSet();

//Dataset for the combobox
DataSet cboDs = new DataSet();

//Create a DGVComboBoxColumn to hold the Types we have in the ADDRESSTYPES Table of the DB.
DataGridViewComboBoxColumn cboCol = new DataGridViewComboBoxColumn();

//Open the DB.
dbCon.Open();

//Grab all the data we need from the Location Info table
OleDbDataAdapter da = new OleDbDataAdapter("SELECT AddrType,isRange,Value1,Value2 FROM LOCATIONINFO", dbCon);

//Grab all the columns from ADDRESSTYPES (ID and Types).
OleDbDataAdapter cboDa = new OleDbDataAdapter("SELECT * FROM ADDRESSTYPES", dbCon);

da.Fill(ds, "LocationInfo");
cboDa.Fill(cboDs, "AddressTypes");

cboCol.Width = 100;
cboCol.DataSource = cboDs.Tables[0];

cboCol.ValueMember = "ID";
cboCol.DisplayMember = "Type";
DataTable dt = ds.Tables["LocationInfo"];

grdAddressInfo.DataSource = dt;

/*
 * Somehow make the ComboBox Column display the correct Dropdown object
 * Based upon the AddrType field.
 */

//Column formatting
grdAddressInfo.Columns.Insert(0, cboCol);
grdAddressInfo.Columns[0].HeaderText = "Address Type";
grdAddressInfo.Columns[1].HeaderText = "Ranged Value";
grdAddressInfo.Columns[2].HeaderText = "From";
grdAddressInfo.Columns[3].HeaderText = "To";

dbCon.Close();

AnswerRe: DataGridView with ComboBox. Need help Pin
Member 447035429-Dec-08 7:33
Member 447035429-Dec-08 7:33 
Questiontext parsing or automatic segmentation of text in c# Pin
lawrenceinba29-Dec-08 6:13
lawrenceinba29-Dec-08 6:13 
AnswerRe: text parsing or automatic segmentation of text in c# Pin
Teuz29-Dec-08 6:52
Teuz29-Dec-08 6:52 
GeneralRe: text parsing or automatic segmentation of text in c# Pin
Member 447035429-Dec-08 7:16
Member 447035429-Dec-08 7:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.