Click here to Skip to main content
16,004,924 members
Home / Discussions / C#
   

C#

 
GeneralRe: Taking a screen shot of a control Pin
Roger Alsing5-Apr-08 23:31
Roger Alsing5-Apr-08 23:31 
GeneralRe: Taking a screen shot of a control Pin
nike_arh6-Apr-08 0:15
nike_arh6-Apr-08 0:15 
GeneralRe: Taking a screen shot of a control Pin
nike_arh6-Apr-08 1:05
nike_arh6-Apr-08 1:05 
GeneralRe: Taking a screen shot of a control Pin
Guffa6-Apr-08 18:02
Guffa6-Apr-08 18:02 
GeneralRe: Taking a screen shot of a control Pin
GuyThiebaut6-Apr-08 2:37
professionalGuyThiebaut6-Apr-08 2:37 
QuestionError: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
sgeorgije5-Apr-08 9:51
sgeorgije5-Apr-08 9:51 
GeneralRe: Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
Luc Pattyn5-Apr-08 10:00
sitebuilderLuc Pattyn5-Apr-08 10:00 
GeneralRe: Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
sgeorgije5-Apr-08 11:05
sgeorgije5-Apr-08 11:05 
Thank you for answering. The main part report's code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;
using System.IO;
using System.Collections;
using System.Configuration;
using System.Management;
namespace DatabaseAccessWithADONET
{
public partial class ReportViewerFormIzv : Form
{
private static string ConStr =

ConfigurationManager.ConnectionStrings["DatabaseAccessWithADONET.Properties.Settings.PersonDatabaseConnectionString"].ConnectionString;

BindingManagerBase bindManager;
private bool PrintLayout = true;
bool loaded = false;
private CustomReportViewerMessages customMessages = null;
int current,max,tip;
public ReportViewerFormIzv()
{
InitializeComponent();

customizeReportViewer();
this.bindManager = this.BindingContext[this.cash.vReportBill, "IDBill"];
current = 0; tip = 0;
}

public void InitializeReport(string formName, string reportDisplayName, string reportPath, ReportDataSource reportDataSource)
{
this.Text = formName;
this.reportViewer.Reset();
this.reportViewer.LocalReport.DisplayName = reportDisplayName;
this.reportViewer.DocumentMapCollapsed = true;
this.reportViewer.LocalReport.ReportPath = reportPath;
this.reportViewer.Messages = this.customMessages;
this.reportViewer.LocalReport.DataSources.Add(reportDataSource);
this.reportViewer.RefreshReport();
}

private void reportViewer_RenderingComplete(object sender, RenderingCompleteEventArgs e)
{

if (!loaded)
{
this.reportViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
this.reportViewer.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.FullPage;
loaded = true;
}
switch (tip)
{
case 0:
this.reportViewer.LocalReport.DisplayName = "Cash bill "+ cmbBon.Text;
break;
case 1:
this.reportViewer.LocalReport.DisplayName = "Cheque bill " + cmbBon.Text;
break;
case 2:
this.reportViewer.LocalReport.DisplayName = "Sell Products " + cmbDate.Text.Replace(':','.');
break;
default: break;
}
}

private void ReportViewerForm_Load(object sender, EventArgs e)
{
using (SqlConnection veza = new SqlConnection(ConStr))
{
veza.Open();
SqlDataAdapter da = new SqlDataAdapter("Select * from vReportProduct order by Date desc", veza);
da.Fill(this.cash.vReportProduct);
vReportProductBindingSource.Sort = "Date DESC";

}

this.ReportProductTableAdapter.Fill(this.cash.ReportProduct);

cash.ReportBill.AcceptChanges();

using (SqlConnection veza = new SqlConnection(ConStr))
{
SemiQuery sq = new SemiQuery();
veza.Open();
SqlDataAdapter da = new SqlDataAdapter("Select * from vReportBill where Tip=0 order by Date desc", veza);
cash.vReportBill.Clear();
da.Fill(this.cash.vReportBill);
max = cash.vReportBill.Rows.Count;
tip = 0;
DataSet ds = new DataSet();
string reportSourceFile = sq.getProjectSourcePath() + @"\ReportGot.rdlc";
SqlDataAdapter dak;
if (cash.vReportBill.Rows.Count > 0)
{
dak = new SqlDataAdapter("SELECT * FROM ReportBill where IDBill=" +

cash.vReportBill.Rows[current]["IDBill"].ToString() + " order by Date desc", veza);

}
else
{
dak = new SqlDataAdapter("SELECT * FROM ReportBill where IDBill=0", veza);
}
dak.Fill(ds);
InitializeReport("Reports", "Cash Bill", reportSourceFile, new ReportDataSource("Cash_Cash", ds.Tables[0]));

this.bindingNavigator1.BindingSource = this.vReportBillBindingSource;
cmbBon.Visible = true;
lblBon.Visible = true;
cmbDate.DataSource = vReportBillBindingSource;
cmbDate.ValueMember = "IDBill";
cmbDate.DisplayMember = "Date";
this.cmbDate.FormatString = "g";

}

outlookBar1.SelectedButton = outlookBar1.Buttons[0];
panel1.Visible = true;

loaded = true;
this.reportViewer.RenderingComplete += new

Microsoft.Reporting.WinForms.RenderingCompleteEventHandler(this.reportViewer_RenderingComplete);

this.reportViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
this.reportViewer.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.FullPage;
this.WindowState = FormWindowState.Maximized;
max = cash.vReportBill.Count;
}
}
}
GeneralRe: Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
Luc Pattyn5-Apr-08 11:20
sitebuilderLuc Pattyn5-Apr-08 11:20 
GeneralRe: Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
sgeorgije5-Apr-08 12:08
sgeorgije5-Apr-08 12:08 
GeneralRe: Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
Luc Pattyn5-Apr-08 13:11
sitebuilderLuc Pattyn5-Apr-08 13:11 
GeneralRe: Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
Member 54067796-Aug-08 2:35
Member 54067796-Aug-08 2:35 
GeneralToolbox control like in VS Pin
Gareth H5-Apr-08 7:50
Gareth H5-Apr-08 7:50 
GeneralC# and Win32_PhysicalMedia SerialNumber from HDD Pin
novadon5-Apr-08 7:02
novadon5-Apr-08 7:02 
GeneralRe: C# and Win32_PhysicalMedia SerialNumber from HDD Pin
Luc Pattyn5-Apr-08 7:42
sitebuilderLuc Pattyn5-Apr-08 7:42 
Generalreading Windows settings (dcom) Pin
Schimaera5-Apr-08 6:33
Schimaera5-Apr-08 6:33 
QuestionHow to test connectivity to a UDP port on a remote system Pin
darthBug5-Apr-08 6:28
darthBug5-Apr-08 6:28 
GeneralRe: How to test connectivity to a UDP port on a remote system Pin
mav.northwind5-Apr-08 8:07
mav.northwind5-Apr-08 8:07 
GeneralRe: How to test connectivity to a UDP port on a remote system Pin
darthBug5-Apr-08 8:57
darthBug5-Apr-08 8:57 
General.NET remoting exception Pin
swati245-Apr-08 4:33
swati245-Apr-08 4:33 
GeneralRe: .NET remoting exception Pin
CodingYoshi5-Apr-08 7:31
CodingYoshi5-Apr-08 7:31 
GeneralRe: .NET remoting exception Pin
mav.northwind5-Apr-08 8:12
mav.northwind5-Apr-08 8:12 
QuestionHow to open a form in tableLayoutPanel control while loading? Pin
S a n d y5-Apr-08 2:34
S a n d y5-Apr-08 2:34 
GeneralAdministrate Indexing Server via Web App Pin
Muhammad Nauman Yousuf5-Apr-08 0:56
Muhammad Nauman Yousuf5-Apr-08 0:56 
GeneralBlocking certain website Pin
the pink jedi4-Apr-08 19:57
the pink jedi4-Apr-08 19:57 

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.