Click here to Skip to main content
15,916,945 members
Home / Discussions / C#
   

C#

 
AnswerRe: DB the way to go? Pin
Guffa10-Aug-05 6:51
Guffa10-Aug-05 6:51 
GeneralRe: DB the way to go? Pin
Morrgan10-Aug-05 7:40
Morrgan10-Aug-05 7:40 
GeneralForm Painting Pin
Greeky10-Aug-05 0:54
Greeky10-Aug-05 0:54 
GeneralRe: Form Painting Pin
Dario Solera10-Aug-05 1:17
Dario Solera10-Aug-05 1:17 
GeneralRe: Form Painting Pin
Greeky10-Aug-05 2:23
Greeky10-Aug-05 2:23 
Questionhow import dll of vc++ in c# Pin
laila1110-Aug-05 0:43
laila1110-Aug-05 0:43 
AnswerRe: how import dll of vc++ in c# Pin
Dario Solera10-Aug-05 1:25
Dario Solera10-Aug-05 1:25 
Generaldatabinding on a datagrid Pin
dhol10-Aug-05 0:20
dhol10-Aug-05 0:20 
Hi I was about to design a form witha datgrid and some buttons with certain operations namely first, previous ,next and last and some text boxes


I have to read two xml file( each xml file has one table)with data in it.
Now I have to create a relation between the two tables and display it in the datagrid.
Now using databinding I have to show the data from the datagrid columns to each text box
when teh next, previous ...etc buttons r clicked.

that is values from one column
for ex:
column name :DESC
values :MR BROS, VT BROS, CT BROS

when next is clicked, the values should be shown from the desc in to the textbox one by one.

This i have did it
this is the folowing code

private DataSet ds = new DataSeyt();

retrieve button click

private void RetrieveButton_Click_1(object sender, System.EventArgs e)
{

DataSet xml1 = new DataSet();
xml1.ReadXml("C:\\CDEV\\Relation\\cost_code.xml");
DataTable dt1 = xml1.Tables["cost_code"].Copy();

DataSet xml2 = new DataSet();
xml2.ReadXml("C:\\CDEV\\Relation\\cost_type.xml");
DataTable dt2 = xml2.Tables["cost_type1"].Copy();

ds.Tables.Add(dt1);
ds.Tables.Add(dt2);


DataColumn parentCol = ds.Tables["cost_type1"].Columns["cost_type"];
DataColumn childCol = ds.Tables["cost_code"].Columns["cost_type"];
DataRelation relTable1Table2;
relTable1Table2 = new DataRelation("cost_typecost_code", parentCol, childCol);
ds.Relations.Add(relTable1Table2);

this.dataGrid1.DataSource = ds.Tables["cost_type1"];
fnDataBindingforTextBoxes();
fnSetCurrencyManager();
}


private void fnDataBindingforTextBoxes()
{
this.ultraCostPaid.DataBindings.Add("Text", ds.Tables["cost_code"],"desscost_paid_by_us");
this.ultraCostType.DataBindings.Add("Text", ds.Tables["cost_code"],"cost_type");

}

private void fnSetCurrencyManager()
{
currManager=(CurrencyManager)this.BindingContext[ds.Tables["cost_code"]];
}


everything is working fine
but databinding on the grid is not used. that is if u select a row from the datagrid it should change the values in the textbox that i have already added data bindings for. if u notice just selct a row from the grid, now the values in that row should show in your textboxes you have put below.

Give a dataview for dataset
pls help me to do this

j o hn
GeneralDetermining if a string is a valid filename for system Pin
misterbear9-Aug-05 23:15
misterbear9-Aug-05 23:15 
GeneralRe: Determining if a string is a valid filename for system Pin
leppie10-Aug-05 0:34
leppie10-Aug-05 0:34 
GeneralCombobox Pin
hongoc2179-Aug-05 21:50
hongoc2179-Aug-05 21:50 
GeneralRe: Combobox Pin
Mohamad Al Husseiny10-Aug-05 2:03
Mohamad Al Husseiny10-Aug-05 2:03 
GeneralRe: Combobox Pin
hongoc21716-Aug-05 5:49
hongoc21716-Aug-05 5:49 
GeneralRe: Combobox Pin
hongoc21719-Aug-05 9:07
hongoc21719-Aug-05 9:07 
GeneralAudio Cropping Pin
Mr. Naveed Butt9-Aug-05 21:35
professionalMr. Naveed Butt9-Aug-05 21:35 
GeneralRe: Audio Cropping Pin
Dario Solera10-Aug-05 1:28
Dario Solera10-Aug-05 1:28 
QuestionHow can I get the text of the textbox which layout in another form? Pin
Member 18740969-Aug-05 20:48
Member 18740969-Aug-05 20:48 
AnswerRe: How can I get the text of the textbox which layout in another form? Pin
zadeveloper.com9-Aug-05 21:35
zadeveloper.com9-Aug-05 21:35 
AnswerRe: How can I get the text of the textbox which layout in another form? Pin
shafqaat10-Aug-05 2:56
shafqaat10-Aug-05 2:56 
AnswerRe: How can I get the text of the textbox which layout in another form? Pin
Mohamad Al Husseiny10-Aug-05 4:46
Mohamad Al Husseiny10-Aug-05 4:46 
GeneralFull screen application with menu Pin
shayro9-Aug-05 19:39
shayro9-Aug-05 19:39 
GeneralRe: Full screen application with menu Pin
zadeveloper.com9-Aug-05 21:53
zadeveloper.com9-Aug-05 21:53 
QuestionHow to add button in DataGrid? Pin
Sachin Gedam9-Aug-05 19:39
Sachin Gedam9-Aug-05 19:39 
AnswerRe: How to add button in DataGrid? Pin
maheswara9-Aug-05 23:52
maheswara9-Aug-05 23:52 
GeneralRe: How to add button in DataGrid? Pin
maheswara10-Aug-05 0:07
maheswara10-Aug-05 0:07 

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.