|
Hi there .
I think , it's better to check your reference files.
Maybe you missed one of your reference . if it is , remove you reference from reference list and add it to your project reference again , and then Rebuild your solution or project , what ever as you want .
DMASTER
|
|
|
|
|
Hello,
What you can try:
In your project explorer, rightclick the Form or usercontrol you can not edit and change the "buildaction" to an other setting and then back to "compile" (I have not the english version and only 2003 so I don't know the exact names).
Then make a rebuild.
Hope it helps!
All the best,
Martin
|
|
|
|
|
Hi, Ok I know why this is happening but pls tell me whats wrong in doing this?
1. My form is like this: Everything is proper and I can view the designer
<br />
<br />
public partial class Form1 : Form<br />
{<br />
}<br />
2. I need to have a special control class say MyPictureBox derived from PictureBox so added the code as follows in file Form1.cs:
<br />
<br />
public class MyPictureBox : System.Windows.Forms.PictureBox<br />
{<br />
}<br />
<br />
public partial class Form1 : Form<br />
{<br />
}<br />
Thats it: Now If I try to open the designer I get the error:
<br />
One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes. <br />
<br />
The service System.Windows.Forms.Design.ISelectionUIService already exists in the service container. Parameter name: serviceType <br />
Hide <br />
<br />
at System.ComponentModel.Design.ServiceContainer.AddService(Type serviceType, Object serviceInstance, Boolean promote)<br />
at System.ComponentModel.Design.ServiceContainer.AddService(Type serviceType, Object serviceInstance)<br />
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IServiceContainer.AddService(Type serviceType, Object serviceInstance)<br />
at System.Windows.Forms.Design.ComponentDocumentDesigner.Initialize(IComponent component)<br />
at System.ComponentModel.Design.DesignerHost.AddToContainerPostProcess(IComponent component, String name, IContainer containerToAddTo)<br />
at System.ComponentModel.Design.DesignerHost.Add(IComponent component, String name)<br />
at System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type componentType, String name)<br />
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)<br />
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type type, ICollection arguments, String name, Boolean addToContainer)<br />
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)<br />
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)<br />
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)<br />
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) <br />
Afterwards, I will not be able to view the original designer but I think the designer related to MyPictureBox which is blank.
But if I put the body of MyPictureBox after the body of Form as shown below, everything is fine!
<br />
<br />
public partial class Form1 : Form<br />
{<br />
}<br />
<br />
public class MyPictureBox : System.Windows.Forms.PictureBox<br />
{<br />
}<br />
Pls let me know what is the procedure in adding a derived UI control class?
Thanks
|
|
|
|
|
Hello,
The Problem is that both classes have design support.
It is not good practice to but them all in one file.
If you put the picturebox in a special file you will also be able to open it over the designer.
All the best,
Martin
|
|
|
|
|
Thank you Martin and others who gave quick answers!
I created another file and things are pretty nice now!
Help is really appreciated
|
|
|
|
|
Hello Every body,
I am new with crystal reports. I want to generate report for those employees whose age is more than 50 yrs.
But I am not able to do so .It is showing all the records.
I had added an crystal report in my project.
I link it with the database through wizard only,
On form1 it had inserted an crystal report viewer. on the load event of the form1 I had used the following code but it is use less.
SqlConnection Connection = new SqlConnection("server='server1'; user id='sa'; password='admin'; database='employee'");
SqlCommand myCommand = new SqlCommand("SELECT * from companyEmp where age < '50'");
myCommand.Connection = Connection;
myCommand.CommandType = CommandType.Text;
SqlDataAdapter DA = new SqlDataAdapter();
DA.SelectCommand = myCommand;
DataSet DS = new DataSet();
DA.Fill(DS);
crystalReportViewer1.SetDataSource(DS.Tables[0]);
crystalReportViewer1.ReportSource = objNewReport;
But it is still showing all the record of companyEmp.
Regards,
rahul saini
|
|
|
|
|
monuSaini wrote: SqlCommand myCommand = new SqlCommand("SELECT * from companyEmp where age < '50'");
U just need:
SqlCommand("SELECT * from companyEmp where age < 50");
'50' -> type string
50 -> int
Regard,
Edwin
|
|
|
|
|
Hello Edwin,
Thanks for ur rply.
But still same problem.
It is showing all the records.
If I am using only this
crystalReportViewer1.ReportSource = NewReport;
then also it is showing all the records.
Rregards,
rahul saini
|
|
|
|
|
may i know the data type of age in your database?
Regards,
Tomi
|
|
|
|
|
Hello Tomi,
Thanks for ur rply.
Its int.
Regards,
rahul saini
|
|
|
|
|
Hi Rahul,
I wonder if u want to show the data if the age is above 50 right?
if u use query:
SELECT * FROM Your_Table Where age < 50
u got an output data age below 50, if u want to show the data where age is more than 50 than u must change your query into :
SELECT * FROM Your_Table WHERE age > 50
i try to my query analizer thats work
Regard,
Tomi
|
|
|
|
|
TomiEdy wrote: if u use query:
SELECT * FROM Your_Table Where age < 50
u got an output data age below 50, if u want to show the data where age is more than 50 than u must change your query into :
SELECT * FROM Your_Table WHERE age > 50
I think U right Tomi, maybe U must check your query Rahul
Regard,
Edwin
|
|
|
|
|
Thank You Edwin
Regard,
Tomi
|
|
|
|
|
SqlDataAdapter adapter = new SqlDataAdapter(yourQuery, conn);
DataSet ds = new DataSet();
DataTable dt = new DataTable("tablename");
adapter.Fill(dt);
ds.Tables.Add(dt);
ds.WriteXml("C:\text.xml");
Then On your crystal report Database Fields:
change your dataset with "text.xml"
If U have finish it, then create a dataset with your query, then change the code like this:
SqlDataAdapter adapter = new SqlDataAdapter(yourQuery, conn);
DataSet ds = new DataSet("YourDataSet");
DataTable dt = new DataTable("tablename");
adapter.Fill(dt);
ds.Tables.Add(dt);
ReportDocument rd = new ReportDocument();
rd.SetDataSource = ds;
crystalReportViewer1.ReportSource = rd;
Regard,
Edwin
|
|
|
|
|
Hello Edwin,
When i m writing the xml it is giving me following error.
ds.WriteXml("C:\text.xml");
Illegal characters in path.
Regards,
rahul saini
|
|
|
|
|
ds.WriteXml("C:\text.xml");
-- \t is the character code for a tab. You need to escape your backslashes by... using another backslash.
ds.WriteXml("C:\\text.xml");
|
|
|
|
|
Hello Edwin,
One of my friend had told me that this issue can be resolved through SELECT EXPERT. Do you had any idea about this.
Regards,
rahul saini
|
|
|
|
|
Hi there .
Look my friend you set you ReportViewer data source it's wrong . you must create new instance of your CrystalReport.rpt file . for example i have an report file named report.rpt .
// Create new instance of your CrystalReport File
Report _Report = new Report();
// Set Report data source ,no your viewer .
_Report.SetDataSource(Your_DataSource);
// Finally set your report viewer report source to your Report file .
crystalReportViewer1.ReportSource = _Report;
DMASTER
|
|
|
|
|
Hi,
I had use this also but again it is showing the same result.(all the records are showing)
this the code i m using
SqlConnection Connection = new SqlConnection("server='sName'; user id='sa'; password='admin'; database='employee'");
SqlDataAdapter DA = new SqlDataAdapter("SELECT empId,empName,empAge from companyEmp where age < 50", Connection);
DataSet DS = new DataSet();
DA.Fill(DS);
newReport objNewReport = new newReport();
objNewReport.SetDataSource(DS.Tables[0]);
crystalReportViewer1.ReportSource = objNewReport ;
Regards,
rahul saini
|
|
|
|
|
Wow , I got it .you are using untyped dataset , right ?
look answer to my question I hope, I can help you .
1: Did you put any typed dataset in your report form ?
2: Did you used directly connection in report ?
Send your email address to my mail : www.Developermaster61@gmail.com
I hope, I elaborate in more detail .
DMASTER
|
|
|
|
|
Hello everyone,
Is there anyone that I can know there was a Mouse Double Click in the MainForm_MouseDown? I currently can detect if there has been a Left or a Right click but I would like to be able to check for Double Click.
if (e.Button == MouseButtons.Left)<br />
{<br />
MessageBox.Show("You have just clicked on " + e.Button + " button.");<br />
MessageBox.Show("X: " + e.X + " -- Y: " + e.Y); <br />
}<br />
if (e.Button == MouseButtons.Right)<br />
{<br />
MessageBox.Show("You have just clicked on " + e.Button + " button.");<br />
MessageBox.Show("X: " + e.X + " -- Y: " + e.Y);<br />
}
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
Hello,
I don't think that it's possible in MouseDown, as MouseDown is fired bevore Click and Double Click.
But MouseUp is fired after Click and DoubleClick.
So this would work:
private bool FlagDoubleClick = false;
protected override void OnDoubleClick(EventArgs e)
{
FlagDoubleClick = true;
base.OnDoubleClick (e);
}
protected override void OnMouseUp(MouseEventArgs e)
{
if(FlagDoubleClick)
{
FlagDoubleClick= false;
}
base.OnMouseUp (e);
}
All the best,
Martin
|
|
|
|
|
Hi,
MouseDown event offers MouseDownEventArgs parameter
its Clicks member contains what you need:
on a double click, the event fires twice, once with Clicks=1, once Clicks=2
|
|
|
|
|
Hello Luc,
I just tested it and saw that it works.
But I don't understand why.
When is the Clicks property reseted?
And isn't a Click only a Click if the MouseUp is excecuted?
I'm sure you will clear my confusion!
Thanks for your time!
-- modified at 5:56 Monday 30th July, 2007
Just did additional tests, and now I think I understand it.
Looks like the DoubleClick is fired only by the correct MouseDown delta time, no second MouseUp needed for the validation.
But it get's fired only after MouseUp is excecuted.
I'm not sure if this behaviour is very logic, but who said that programming has to be logic at all!
All the best,
Martin
|
|
|
|
|
Hi Martin,
Martin# wrote: I just tested it and saw that it works
A click consists of a down followed by an up (both keyboard and mouse)
To count clicks, you could wait until you get a click, then increment counter;
or you could simply count physical downs (cant have two physcial downs without an
up in beteen !)
So you may argue that the member name should have been Count instead of Clicks,
but it is no miracle they can make it work.
And you would be right if you don't like MSDN saying "MouseEventArgs.Clicks gets
the number of times the mouse button was pressed and released"
|
|
|
|