Click here to Skip to main content
15,860,972 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201824-Nov-17 2:56
C Sharp coder 201824-Nov-17 2:56 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
Eddy Vluggen24-Nov-17 3:06
professionalEddy Vluggen24-Nov-17 3:06 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201824-Nov-17 3:20
C Sharp coder 201824-Nov-17 3:20 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
Eddy Vluggen24-Nov-17 3:24
professionalEddy Vluggen24-Nov-17 3:24 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201824-Nov-17 3:39
C Sharp coder 201824-Nov-17 3:39 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
Eddy Vluggen24-Nov-17 3:42
professionalEddy Vluggen24-Nov-17 3:42 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201824-Nov-17 3:52
C Sharp coder 201824-Nov-17 3:52 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
Eddy Vluggen24-Nov-17 5:10
professionalEddy Vluggen24-Nov-17 5:10 
Member 13515702 wrote:
i'm not perfect the C# code
Yes, well, we all have to start somewhere, and I'm still making foolish mistakes after over 10 years of experience.

You have code in the "Form_Load" event, right? You can put that code into its own method, and than call it from that event. Something like below;

C#
private void Bihourlyforline_Load(object sender, EventArgs e)
{
  this.DoLoad();
}

void DoLoad()
{
// TODO: This line of code loads data into the 'trainningDBDataSetforbihourly1.viewBiHourly3' table. You can move, or remove it, as needed.
this.viewBiHourly3TableAdapter.Fill(this.trainningDBDataSetforbihourly1.viewBiHourly3);
// TODO: This line of code loads data into the 'trainningDBDataSetforbihourly1.tblLine' table. You can move, or remove it, as needed.
this.tblLineTableAdapter.Fill(this.trainningDBDataSetforbihourly1.tblLine);
// TODO: This line of code loads data into the 'trainningDBDataSetforbihourly1.tblLine' table. You can move, or remove it, as needed.
this.tblLineTableAdapter.Fill(this.trainningDBDataSetforbihourly1.tblLine);

this.reportViewer1.RefreshReport();

SetParameters(cbtimeblockline1.Text,cbtimeblockline2.Text,dateTimePicker1forlinebihourly.Text, cbline.Text);
this.reportViewer1.RefreshReport();
}

This way, the "Load_Form" event will just simply call the "DoLoad" method when it needs to populate the tables. Add a button, and an event-handler, and call the method from there too;
C#
public void Button1_Click(object sender, EventArgs e)
{
  this.DoLoad();
}
That would execute the code in the "DoLoad" method if a button is clicked (executing the same lines that you would when you Load_Form).

That is preferred over the alternative, where you raise your "Load_Form" event manually in the OnClick of the button (see below for wrong example);
C#
public void Button1_Click(object sender, EventArgs e)
{
  this.Bihourlyforline_Load(null, EventArgs.Empty);
  // or worse, yet
  this.Bihourlyforline_Load(null, null);
}

Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]

GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201828-Nov-17 17:48
C Sharp coder 201828-Nov-17 17:48 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201828-Nov-17 17:56
C Sharp coder 201828-Nov-17 17:56 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
Eddy Vluggen29-Nov-17 0:27
professionalEddy Vluggen29-Nov-17 0:27 
Questionerror:The remote server returned an error: (411) Length Required. Pin
Urmila Pawar22-Nov-17 18:44
Urmila Pawar22-Nov-17 18:44 
AnswerRe: error:The remote server returned an error: (411) Length Required. Pin
Jochen Arndt22-Nov-17 21:28
professionalJochen Arndt22-Nov-17 21:28 
QuestionTabcontrol and treeview data binding Pin
Hervend22-Nov-17 12:59
Hervend22-Nov-17 12:59 
AnswerRe: Tabcontrol and treeview data binding Pin
Mycroft Holmes22-Nov-17 13:15
professionalMycroft Holmes22-Nov-17 13:15 
Questionhow svd(singular decompostion value) works for matrix? Pin
Isawyouoo22-Nov-17 4:00
Isawyouoo22-Nov-17 4:00 
AnswerRe: how svd(singular decompostion value) works for matrix? Pin
M-Badger22-Nov-17 4:36
M-Badger22-Nov-17 4:36 
GeneralRe: how svd(singular decompostion value) works for matrix? Pin
Isawyouoo22-Nov-17 5:00
Isawyouoo22-Nov-17 5:00 
GeneralRe: how svd(singular decompostion value) works for matrix? Pin
OriginalGriff22-Nov-17 8:26
mveOriginalGriff22-Nov-17 8:26 
GeneralRe: how svd(singular decompostion value) works for matrix? Pin
Isawyouoo23-Nov-17 11:19
Isawyouoo23-Nov-17 11:19 
Questioncan't add combobox Items (C#) Pin
Dunnewijk22-Nov-17 3:43
Dunnewijk22-Nov-17 3:43 
AnswerRe: can't add combobox Items (C#) Pin
Pete O'Hanlon22-Nov-17 4:48
subeditorPete O'Hanlon22-Nov-17 4:48 
GeneralRe: can't add combobox Items (C#) Pin
Dunnewijk22-Nov-17 5:04
Dunnewijk22-Nov-17 5:04 
GeneralRe: can't add combobox Items (C#) Pin
Dave Kreskowiak22-Nov-17 5:15
mveDave Kreskowiak22-Nov-17 5:15 
GeneralRe: can't add combobox Items (C#) Pin
Sascha Lefèvre22-Nov-17 5:20
professionalSascha Lefèvre22-Nov-17 5:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.