Im in over my head...

Hey everyone, I am in over my head and was looking for a little bit of guidance. I just started learning .NET last week and my boss is needing me to develop an application for 100 users. The only real programming I have done was in VB6 and that was mainly for little utility programs to import vendor files into a database, create text files to convert and import data from one system to another, that kind of stuff. So here I am trying to develop my first multi-user program, in a language that I don't know, and in an object oriented environment which I know very little about. Yay.

I have run into a couple of challenges that I am not sure how to approach and figured maybe some of you could point me in the right direction. Both of these issues are related to opening a form, prompting another form to open and gathering information, and then sending that information back to the first form.

The first scenario: When I run the application, I have a menu of different screens. I select the "Benefits Management" screen (which has information about an employee's benefits). That screen opens and all of the data fields are blank. I then want to hit a hot-key that opens another form with a listing of employees. When I select the employee and hit a command button, I want that employee list form to disappear and the first form to automatically display all the benefits information for the selected employee.

The second scenario: I have a reports screen with a dropdown list of numerous reports and then a crystal reports viewer below. I select a report and then another small form opens up with all of the parameters required by that particular report. I enter the parameter data and hit a command button and again, that small form passes the entered data back to the original reports form and the report is automatically displayed, based on the parameters entered by the user.

The part I am having trouble with on both of these scenarios is getting the data from the second forms that "pop up" back to the original forms, and then those forms responding by displaying the necessary information. I have read information on passing data between forms but nothing seems to really work for me. Do I need to set up events on the second pop up forms and then create event handlers on the first forms that will respond once the employee has been selected (scenario 1) or the report parameters have been entered (scenario 2)?

I'm not looking for code specifically, just some direction on the logical approach for doing this.

Also, I don't really have a main application class or anything like that at this point. I just have my MDI form and then about 10 other forms.

Uhhh....help?
[2763 byte] By [KC GSR] at [2007-11-19 14:09:21]
# 1 Re: Im in over my head...
on your first scenario...

since the employees list form and the employee benefits form technically refer to information regarding employees, why not put them both on the same form, and use a tab control instead? that way, tab page 1 for example, contains the employee listing, and tab page 2 may contain the benefits information...what do u think..?

i will get back to you on your second scenario...(i think u will have to learn transferring info from one form to another...its not that hard...)

hope this helps...
nikko at 2007-11-10 3:16:05 >
# 2 Re: Im in over my head...
Thanks for the reply!

To answer your question...the employee list form is a generic form that will be used by MANY other forms in the application. I am going to have HR screens, benefits screens, work comp screens, payroll screens...I wanted to create one generic "dialog window" that can be called by many of the other screens in the system to return a particular employee.
KC GSR at 2007-11-10 3:17:05 >
# 3 Re: Im in over my head...
ok then...in that case, i suggest creating an MDI application.that way, all forms will be "contained" inside a single "container", and window management will become a lot easier...

as for transferring data from one form to another, its relatively easy, it just depends on what type of controls you are using...

il send u a sample app that sends (transfers) info from textboxes from Form1 to Form2, as soon as i find where the #$%^&* app is... :D
nikko at 2007-11-10 3:18:12 >
# 4 Re: Im in over my head...
Show those popup forms as Modal dialog(Form.ShowDialog()). You need to have "OK" and "Cancel" button in the form. Whatever the data that is entered in the Form should have corresponding public variable or property. Update the Form.DialogResult property when the OK or Cancel button is clicked.

When the user click "OK" or "Cancel" button, the code flow will return to the place where you called "ShowDialog()" method. There, check the dialog result. If it is ok, then retrieve the data from the form object (even though the window is closed, the form object will still be there in memory)

[The following code is in C#. Please convert it to VB.NET]

MyForm frm = new MyForm();
DialogResult result = frm.ShowDialog(<parent form object>);
if (result = DialogResult.OK)
{
// get the values from MyForm object
string somstring = frm.SomeValue1;
int someint = frm.SomeValue2;

.......................
}
poochi at 2007-11-10 3:19:03 >
# 5 Re: Im in over my head...
i couldnt find the old app, so here's a new one.its very crude, but it might help u in some way...

pls find the attached zip...to use, run the app,display both child forms, press the transfer button, then see what happens...

happy coding!
nikko at 2007-11-10 3:20:11 >
# 6 Re: Im in over my head...
Thanks a TON everyone! With all of your help I was able to figure it out.
KC GSR at 2007-11-10 3:21:10 >