Click here to Skip to main content
15,441,149 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to refresh reportviewer when SQL input data changed Pin
C Sharp coder 201824-Nov-17 2:56
MemberC 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
MemberC 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
MemberC 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
MemberC 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
MemberC 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
MemberC 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
MemberUrmila 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
MemberHervend22-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
MemberIsawyouoo22-Nov-17 4:00 
AnswerRe: how svd(singular decompostion value) works for matrix? Pin
Mike-MadBadger22-Nov-17 4:36
MemberMike-MadBadger22-Nov-17 4:36 
GeneralRe: how svd(singular decompostion value) works for matrix? Pin
Isawyouoo22-Nov-17 5:00
MemberIsawyouoo22-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
MemberIsawyouoo23-Nov-17 11:19 
Questioncan't add combobox Items (C#) Pin
Dunnewijk22-Nov-17 3:43
MemberDunnewijk22-Nov-17 3:43 
AnswerRe: can't add combobox Items (C#) Pin
Pete O'Hanlon22-Nov-17 4:48
mvaPete O'Hanlon22-Nov-17 4:48 
GeneralRe: can't add combobox Items (C#) Pin
Dunnewijk22-Nov-17 5:04
MemberDunnewijk22-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.