how can i redirect from one form to another in visual studio.Or even better would be if i can just change few panels in the form when i click change or save button for eg.
Thanks

Edited 6 Years Ago by sdhawan: n/a

Form2 f2 = new Form2(); //call the form you want to open
this.close();
f2.show();

how should i pass reference to this form.I tried creating a new project andpass that as refernce but that didnt work.

Thanks a lot .It worked I have one more question.What i did in the second form is to pop up calendar , how can i select date in the calendar and look for that dat in databse.Thanks a lot again for all the help

first of all to pop up a calendar you need to use a datetimepicker and what do you mean to look for the data in database? are you using an sql server or access database?

I am using sql server .I am pretty new to this stuff so have no idea about datetime picker.Thanks

datetimepicker is like a textbox that can be added from the toolbox. It displays the calendar in a small box. I haven't understood exactly what do you want to do with the date etc from or to the database

I have a table named dictionary which contains word and date on which that word was added to databse. what i am trying to do is to ask the user to select a date from calendar and then look for that date in databse, if that date exist then display all the words that were added on that date.Thanks

SqlDatareader rdr;
SqlConnection conn = new SQLConnection("Pass connection string");
conn.open();
Sqlcommand cmd = new SqlCommand("Select word,date from dictionary",conn);
rdr = cmd.executenonquery();
bool iftrue = false;
while(rdr.read())
 {
    if(rdr[0].tostring() == (datatimepickername)
    {
       iftrue=true;
    }
 }
if(iftrue=true)
{
   cmd = new SqlCommand("SELECT word,date from dictionary where date ='"+datetimepicker"'");
cmd.executenonquery();
}

Then put the values in a datagridview or textboxes

awesome thanks a lot.and one more thing .how can i write a query to pull words that starts with a when i click on a or b when i click on b and so on.Thanks for all your help you have been really helpful

sorry i do have a question
how can i write a query to pull words that starts with a when i click on a or b when i click on b and so on.Thanks for all your help you have been really helpful

SELECT word FROM table
WHERE Name LIKE '%a%' /* %a% is used to find where there are characters in the whole word while a% selects word starting with a */
This question has already been answered. Start a new discussion instead.