C# .NET - how to write coding for next and preview button codings?

Asked By Prem Anandh on 15-Oct-08 10:44 AM
how to write coding for next and preview button codings?

reply - Perry replied to Prem Anandh on 15-Oct-08 01:09 PM

Hi,

There is nothing special in these two buttons code. When user click next, you will need to write your code on NextButton click event which might show another form or do some processing and displays message. In Preview button mostly it will be in last form just before submitting. When user click preview button you just need to need to display a form that you have already created with all the values entered by the user. You need to save all the values in the some forms of variable and just put those values entered by the user in preview form.

Regards,
Megha

reply - Binny ch replied to Prem Anandh on 15-Oct-08 01:39 PM

By creating the instance of the form and calling it with show method will open the respective forms u want.

Try this code:

U might be having theorder in which the respective form should open; write this part of the code;

private void buttonNext_Click(object sender, System.EventArgs e)

{

Form3 f3=new Form3();

f3.ShowDialog();

}

private void buttonPrevious_Click(object sender, System.EventArgs e)

{

Form2 f2=new Form2();

f2.ShowDialog();

}

next and preview button codings - Sagar P replied to Prem Anandh on 16-Oct-08 12:09 AM

Can you tell us what is a exact functionality you want on click of these buttons. Coz these buttons will have diff functionality in diff scenario;

Actually we used Next Button to dispaly next record from database; like suppose we have dispalyed 1st record on the form next button will display 2nd record  and so on......

For that we just have to take all the records into dataset , take one global variable which will tell you the number of current record dispalyed. Then you just have to add one to display new record.

Also you can use next button to go on next page when we have dispalyed data in datalist.

see this link;

http://www.dotnetspider.com/resources/20996-Datalist-Paging-With-Previous-Next-Button.aspx

Same is with the previous button, we can go to previous record or page by using previous button.

And preview button we normally used in screen saver, when we are dealing with images.

We use preview button to preview the image in this case. see this link;

http://www.harding.edu/fmccown/screensaver/screensaver.html