Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dataset, dataconnection, variable & textbox

Status
Not open for further replies.

TiCi

Programmer
Dec 23, 2003
11
0
0
ID
Hello.. i'm still new in C#.. and my programming language before C# is FoxPro.. and.. it's very different..
so after trying and learning C# for several weeks... i have a few question about this programming language.. pardon me if i ask a lot.. :D

1. how to set public variabel in C#? if it's in VFP you can put public variable anywhere.. but in C#, where should i put it so that i can extract information for other forms.
e.g: i want to put user's name from loginForm into mainForm.

2. how to view the context of the cell's grid into a textbox. i've search for an example in MSDN.. but i can only found it how to insert it to listbox, or to view it with Console.WriteLine.

3. if i make an mdi form, can i make one database connection in my parent form for all of my child form? and how do i do that?

4. in VFP i can make a cursor that consist of 3 fields, and only two of them that i view in datagrid, but the 3rd field can still be extract for it's informations. e.g: i make a cursor from Customer table, which consist IDCust, NameCust, and PhoneCust. and i only show NameCust and PhoneCust. but i still can retrieve IDCustomer.
yesterday i've tried that method in C# with ColumnMappings (dtmForm2.ColumnMappings.Add("IDCustomer", "");), but.. i can't retrieve the data... how can u do it in C#?

5. does dataset in C# is the same with data environment in VFP? can i make one dataset for all of my forms? because every forms usually needs different kind of joint cursors..

thanx before... sorry if my english is confusing, and sorry if ask to many question... :D anyway i also appreciate if u can only give references..
 
big questions. here are some not very thorough answers.

there are, as ever a million ways to do these things.

off the top of my head.

1. create a singleton userinfo class.

2. i don't entirely understand you mean by context, but this may work:

Code:
textBoxN.Text = string.Format("{0}:{1}", dataGrid1.CurrentCell.RowNumber, dataGrid1.CurrentCell.ColumnNumber)

3. the easiest way is to create the connection as a public property of the parent form. you may have problems with children competing for it but that's another question.

4. look at adding custom tablestyles and datagridcolumnstyles to your grid.

5. if you need a common dataset, make it a property of the parent form.

hope this helps,

mr s. <;)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top