Click here to Skip to main content
15,901,373 members
Home / Discussions / C#
   

C#

 
GeneralRe: Starting the application with windows startup Pin
JonasSyrstad1-Jun-05 9:23
JonasSyrstad1-Jun-05 9:23 
QuestionHow to bold the dates Pin
pakFari1-Jun-05 8:35
pakFari1-Jun-05 8:35 
AnswerRe: How to bold the dates Pin
Robert Rohde1-Jun-05 10:59
Robert Rohde1-Jun-05 10:59 
GeneralSchema and OdbcConnection Pin
PaleyX1-Jun-05 7:57
PaleyX1-Jun-05 7:57 
GeneralRe: Schema and OdbcConnection Pin
PaleyX1-Jun-05 11:56
PaleyX1-Jun-05 11:56 
GeneralBasic Question : Opening a new windows form and populating data from parent datagrid Pin
Anonymous1-Jun-05 7:43
Anonymous1-Jun-05 7:43 
GeneralRe: Basic Question : Opening a new windows form and populating data from parent datagrid Pin
nemopeti1-Jun-05 9:08
nemopeti1-Jun-05 9:08 
GeneralRe: Basic Question : Opening a new windows form and populating data from parent datagrid Pin
Susan Hernandez3-Jun-05 14:51
Susan Hernandez3-Jun-05 14:51 
There's a few different ways to do this. First make sure you have the event hooked up to the DataGrid's Click or DoubleClick event, whichever you prefer.

this.dataGrid1.DoubleClick += new System.EventHandler(this.dataGrid1_DoubleClick);

Next set up your handler method (visual studio inserts this stub in for you very easily)

<br />
private void dataGrid1_DoubleClick(object sender, EventArgs e)<br />
{<br />
}<br />


Now let's say that in your parent datagrid, the first Column in the datagrid is an integer Invoice number. You want to retrieve that information for that invoice number to open up the second Data Entry screen.

<br />
private void dataGrid1_DoubleClick(object sender, EventArgs e)<br />
{<br />
  int invNumb = Convert.ToInt32(dataGrid1[dataGrid1.CurrentRowIndex, 0]);<br />
  DataSet myInvoiceInformation = GoGetMeTheInvoice(invNumb);<br />
<br />
  MyNewInvoiceForm invFrm = new MyNewInvoiceForm();<br />
  invFrm.InvoiceInfoToShow = myInvoiceInformation;<br />
<br />
  invFrm.ShowDialog();<br />
}<br />


In this very very simple example, we create a dataset with the information, assuming you have some method that retrieves the information. Your Data Entry form has a Public Property of type DataSet that allows you to set the dataset with the invoice information. You could also write another constructor to your Data Entry form so you don't have to write 2 lines of code.

Also, you can set up the DataGrid with a TableStyle if you want, so that your identifying information is always in the first column of the datagrid, but it's hidden. In my case I just set the width of the first column to 1px.

Hope this simple example helps.
GeneralEnding a Worker Thread Pin
goldoche1-Jun-05 6:03
goldoche1-Jun-05 6:03 
GeneralRe: Ending a Worker Thread Pin
S. Senthil Kumar1-Jun-05 7:14
S. Senthil Kumar1-Jun-05 7:14 
Generalpopulating a listview control in another from Pin
Hadi Riazi1-Jun-05 6:03
Hadi Riazi1-Jun-05 6:03 
GeneralEquivalenet Tell me equivalenet space function in C#.net Pin
ksanju10001-Jun-05 5:19
ksanju10001-Jun-05 5:19 
GeneralRe: Equivalenet Tell me equivalenet space function in C#.net Pin
S. Senthil Kumar1-Jun-05 7:20
S. Senthil Kumar1-Jun-05 7:20 
GeneralRe: Equivalenet Tell me equivalenet space function in C#.net Pin
Dave Doknjas1-Jun-05 14:23
Dave Doknjas1-Jun-05 14:23 
GeneralBubble Sort Pin
Da`Sooty1-Jun-05 4:41
Da`Sooty1-Jun-05 4:41 
GeneralRe: Bubble Sort Pin
Marc Clifton1-Jun-05 5:05
mvaMarc Clifton1-Jun-05 5:05 
GeneralRe: Bubble Sort Pin
DavidNohejl1-Jun-05 8:17
DavidNohejl1-Jun-05 8:17 
GeneralCreating a WebForm to interact with Word Pin
samoore1-Jun-05 4:23
samoore1-Jun-05 4:23 
GeneralRe: Creating a WebForm to interact with Word Pin
Rhys Gravell1-Jun-05 6:06
professionalRhys Gravell1-Jun-05 6:06 
GeneralRe: Creating a WebForm to interact with Word Pin
moose12316-Jun-05 6:29
moose12316-Jun-05 6:29 
GeneralCompiler Warning CS1595 Pin
Nigel Savidge1-Jun-05 4:17
Nigel Savidge1-Jun-05 4:17 
GeneralRe: Compiler Warning CS1595 Pin
Colin Angus Mackay1-Jun-05 4:20
Colin Angus Mackay1-Jun-05 4:20 
GeneralRe: Compiler Warning CS1595 Pin
Nigel Savidge1-Jun-05 4:26
Nigel Savidge1-Jun-05 4:26 
GeneralComboBox DataSource property Pin
JawsSaint1-Jun-05 4:09
JawsSaint1-Jun-05 4:09 
Generaloverride a WN_NCACTIVATE Pin
Anonymous1-Jun-05 4:08
Anonymous1-Jun-05 4:08 

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.