|
|
Tereq,
you can use a typed dataset to do that, for instance. This dataset can be filled in code, maybe using a Data Adaptor (along with a data connection and a SQL Select command), or manually, if you want.
The point is that you need add this dataset as a datasource to your crystal report. Therefore, you just need do drag and drop the desired field onto your report.
About showing a label associated with the fields i'm not sure. Just as a sugestion (not so good), you could create another typed dataset (or another datatable, or even, another column) to hold the string value associated with the numeric value. These stirng values could be code filled based on numeric values.(I supposed you are trying associate a numeric value (from the DB) to a sring value (excelente, very good, and so on...))
I'm sure will find something very useful if you search for a article related to crystal here in code project.
cya
|
|
|
|
|
Hi,
I've just spent days trying to learn Crystal Reports that ships with VS2005 and have found the easiest way to do anything is to create specific database tables that hold the data you wish to incorporate into your Crystal Report. Then just drag the field from the datatable view onto the Crystal Report.
Good luck and BTW. - I couldn't find *any* decent help on how to use Crystal Reports VS2005 *anywhere*. Some joker called his article "A beginners guide to CR" but it certainly isn't written for beginners.
Glen Harvy
|
|
|
|
|
sure, crystal report is harder than .rdlc reports in VS2005, but it's a lot more powerfull
|
|
|
|
|
pontonet wrote: sure, crystal report is harder than .rdlc reports in VS2005, but it's a lot more powerfull
It's a world apart , now that I think I've got the basics!
Glen Harvy
|
|
|
|
|
Hey guys
just another quicky, i want a simple way of discovering all "text boxes" on an application via interop... i figured that getting the class name would work.... mmm kinda,
some control give me:
Class: Edit
but apps wrote in .net give me:
Class: WindowsForms10.EDIT.app.0.3b95145
if there another way of asking if this hWnd IntPtr a textbox (edit) control?
Cheers
Will
|
|
|
|
|
Hello
With this way you are trying to access CEdit controls which differs from Edit control in one simple fact, CEdit s are made by MFC, while the Edit scope is much larger. Each CEdit is a windows Edit control but not vise versa.
To identify an Edit control -whether CEdit, C# Edit, or whatever...-, you should sen a EM_ message specific to it. If it give you a respond, then it supports this message and it's an Edit control. If not then the probability goes that it's not an edit control.
Much harder, but more sensitive to Edit sontrols. Of course carful choice of the EM_ message you'd send is important. I don't have any in mind, but you should search windows messages for the best one -even if it was not an EM_ message-. Try EM_GETLIMITTEXT for a start. If it returns a number larger than zero, you are probably in a valid esit control.
Regards
|
|
|
|
|
Is it possible to use .ico files for the Image property of ToolbarItems, Buttons, etc? If so how? If not does anyone know a good program I could use to convert .ico's to a bmp, jpg, etc?
Thanks!
- Aaron
|
|
|
|
|
Hello
monrobot13 wrote: Is it possible to use .ico files for the Image property of ToolbarItems, Buttons, etc?
Yes. In the designtime click on image property => Click import => emove the images filter => Choose in .ico file
monrobot13 wrote: a good program I could use to convert .ico's to a bmp, jpg, etc?
You don't need any extra program to convert icons to bitmaps. use MyIcon.ToBitmap() method
Also you can add icons to your resources files directly.
Regards
|
|
|
|
|
Hi guys;
I have 2 listboxes in my form that I am loading data into on load of the form. Here is the code for one of them:
public void populatelbBranches()
{
SqlConnection cnn=null;
SqlCommand cmd=null;
SqlDataReader reader=null;
try
{
cnn=new SqlConnection(m_ADBCnn);
cnn.Open();
string query="SELECT BrnId,Name FROM tblBRANCHES";
cmd = new SqlCommand(query, cnn);
reader = cmd.ExecuteReader();
if (reader != null)
{
while (reader.Read())
{
lbBranches.Items.Add(reader["BrnId"]+ " - " + reader["Name"]);
}
}
}
catch (Exception ex)
{
MessageBox.Show(this,ex.Message)
}
finally
{
reader.Close();
cmd=null;
lbBranches.SelectedIndex = 0;
if(cnn!=null && cnn.State !=ConnectionState.Closed)
{
cnn.Close();
}
cnn=null;
}
Is there any way I can make the reading/loading faster? it takes almost 2 minutes to populate 3500 records. It takes 2 seconds if I run the query in SQL Query Analyzer. Please Help!!!!
sasa
|
|
|
|
|
Hello
As a small demo of the time cose of a try block:
long TicksA, TicksB;
TicksA = DateTime.Now.Ticks;
try
{
int A = 0;
while (A < 1000000000)
A++;
}
catch { }
TicksA = DateTime.Now.Ticks - TicksA;
TicksB = DateTime.Now.Ticks;
int B = 0;
while (B < 1000000000)
B++;
TicksB = DateTime.Now.Ticks - TicksB;
MessageBox.Show(TicksA.ToString() + "\n" + TicksB.ToString());
1- Your code will never be as fast as the QueryAnalyzer
2- Try removing the try and if blocks -Bad but fast-
3- As a last solution you might want to make multiple threads reading at multiple areas of your datatable -like download accelerators-
4- Make a thread to read and give it high priority -dangerous-
Regards
|
|
|
|
|
It's very strange, speacially in only 3500 rows. Your code are pretty good.
As a sugestion, try to use a dataset to retrieve these values using a Data Adaptor to fill it. And then, set the datasource property of you list box. But i think this will not solve your problem, cause it's indirect access, and you have made simple access, which is faster.
good luck!
|
|
|
|
|
hey guys, ive wrote a little app that takes a given a IntPtr handle to a random application.... it when gets all childwindows and looks for the first EDIT (CEdit) class and then tries to set focus to it.. i know it seems pointless, but its part of a large plan! hehe
anyway, its just not working! im calling SetFocus(IntPtr) to the Edit class and its just ignore me! (ive even tried bringing the parent application to te front - that works btw)
any ideas why SetFocus isnt putting the cursor in the Edit class ready for user input?
|
|
|
|
|
Hello
Quoted from MSDN: If the hWnd parameter is invalid or the window is not attached to the calling thread's message queue, the return value is NULL. To get extended error information, call GetLastError.
Try to see the returned value, and GetLastError() .
Also I suggest to SendMessage(WM_SETFOCUS) yourself, instead of calling SetFocu(hWnd).
Regards
|
|
|
|
|
hi there,
when i use SetFocus(), it doesnt work and i get this last error message:
1008 An attempt was made to reference a token that does not exist. ERROR_NO_TOKEN
(i looked up the message on google)
however - if i do what u suggested it works
do you know why this way works and the other one doesnt?
|
|
|
|
|
Hello
I'm glad that it works now.
If you revise the qoute I posted from MSDN, you'd notice that SetFocus() function, sends the message to the current message queue. You are sending WM_SETFOCUS message to another application with another message queue. That's why you need to explicitly send the message yourself.
Regards
|
|
|
|
|
ahhhhh thats excellent!!
i understand it now!
thanks ever so much for your help this evening, its much appriciated!
Regards,
Will
|
|
|
|
|
Is there a way I can extract the extact data type strings but sql via ADO.NET.
I need to know the exact name of the data type from sql.
I tried creating a data table and filling it, then examining the columns. But, only gives me a .net data type. For instance, smalldatetime is converted to DateTime.
I need to know what it is before the conversion.
thanks
nick
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
you could try to perform a query which shows you the tables structure
( MySQL: desc Tablename; - Firebird: show table Tablename; ) and parse the
result in your programm. That way you would get the name of the datatypes used by your database.
|
|
|
|
|
Hi guys,
I have a ToolStrip control that is not redrawing properly. It seems to not be receiving a paint message when it should (ie if I bring any other window in front of it, it doesn't redraw). This is the structure it sits in:
- SplitContainer
- TabControl
- TabPage
- ToolStripContainer
- ToolStrip
It also doesn't redraw consistently when I switch between TabPages. Has anyone come across this before?
Many thanks,
Simon
PS This problem is occurring in a Windows Forms application for the desktop.
|
|
|
|
|
Hello
Yes. ToolStip control isn't supposed to redraw itself without having the focus- AFAIK-. This is normal.
Regards
|
|
|
|
|
Hi Nader,
Thanks for your reply. However, it does seem a bit odd because when I drag a window in front of Outlook the toolstrips there redraw perfectly well. Is there an obvious technique I should be aware of for forcing a redraw?
Many thanks,
Simon
|
|
|
|
|
Hello
It looks like I got your question all wrong!! Now I get what you mean.
Why doesn't your ToolStrip draw itself?? Doesn't it fire paint events?
To demonstrate that, I made the same cascade that you did, then I added a ListBox, and then the following code for each paint event in the cascade:
private void toolStripButton1_Paint(object sender, PaintEventArgs e)
{
listBox2.Items.Add("Button Paint");
}
private void toolStrip1_Paint(object sender, PaintEventArgs e)
{
listBox2.Items.Add("ToolStrip Paint");
}
private void toolStripContainer1_ContentPanel_Paint(object sender, PaintEventArgs e)
{
listBox2.Items.Add("Container Paint");
}
The listbox addes the item in the same order as the paint events should be fired. Al the Paint events are fired appropriately.
Try this demo in your code to see if the paint events are fired or not.
Regards
|
|
|
|
|
Thanks for your time on this Nader. I was hoping someone would say "Oh, that's a common problem and you just need to set property x". I was trying to avoid a full on investigation as I'm on a schedule with this thing. However, I will use your code and start digging into the problem to find out what's going on.
Many thanks again,
Simon
|
|
|
|
|
Am trying to dynamically build a tab, multipage and pageview
protected Microsoft.Web.UI.WebControls.TabStrip tc;
protected Microsoft.Web.UI.WebControls.MultiPage mp;
protected System.Web.UI.WebControls.Label txt;
Microsoft.Web.UI.WebControls.Tab tab=new Microsoft.Web.UI.WebControls.Tab();
Microsoft.Web.UI.WebControls.PageView pv= new Microsoft.Web.UI.WebControls.PageView();
//Am building a control here and adding it to pv
System.Web.UI.WebControls.TextBox txt= new TextBox();
txt.Text = "Microsoft";
pv.Controls.Add(txt);
pv.ID = id.ToString();
tab.TargetID = pv.ID;
Error: TargetID does not point to a valid PageView
the tab.TargetID has to be set to pv.(something).
can somebody help me on this?
rmr
rmr
|
|
|
|