I have a form1 and form2. in form1 there is a textbox which consist any department. and the another textbox consist room related to only these depatment. besides room textbox there is a searchbutton. which opens form2. form 2 consist a gridview. and this grid view should be filled by only selected department in form1. and when this form2 opens then in grid view also shows room is booked or free...

Sounds like a plan. What have you done so far?

Use Querystring concept .pass department and rooms as string type to second form.

Step1: On Button Click- form1
Response.Redirect("Form2.aspx?Dept=" + Textbox1.Text +"&Rooms="+Textbox2.Text);
Step2 : Bind Grid --Form2
String Dept=Request.QueryString["Dept"].tostring();
String Rooms=Request.Querystring["Rooms"].tostring();
Step 3: Pass these two variables to Stored Procedure.


I thought this will help you.
thanks

Response.Redirect is for web pages, he said he had forms so won't work here

I am new in coding plz clear how it will done and i have not use anything this is for c# windows applicaton.

Again, what have you done so far?

just i have not done anything i have already explain what i want..

commented: Needs to show some effort -1
commented: I agree! +0

Do you expect us to write all the code for you? This is a help forum, not a code writing service.

I have a question am new in programming C# and I have tried to make a group box invisible in form2 from another form how will dis be done.
this is me code.pla help
private void button1_Click()
{
form2 frm2=new form2();
fr2.show();
frm2.groupbox.visible=false;
}

I can only discuss concept as you did not provide any code.

I think, what you are trying to do is to
- transfer data between 2 forms.
- form2 should know what data is selcted in form1

Almost what emmyt told is recommended for opening one from using another.

private void button1_Click()
{
form2 frm2=new form2();
fr2.show();
frm2.groupbox.visible=false;
}

Now your form is opened but no data transfer has been done. So I will recommend you to change the constructor of form2 so that it accepts data from form1.

///In form1
t_Data aData = GetSelectedRowData(DataGridViewInstanceOfForm1) //write your fown function)
form2 frm2=new form2(aData);
fr2.show();
frm2.groupbox.visible=false;
//In form2, use this constructor
public Form2(t_Data aData)
{
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.