|
|
Mohammad Dayyan wrote: As I know , Crystal Report works with Data Base and DataSet !
I couldn't find any samples of Crystal Report without using DataSet because of in my App there isn't a DataSet .
If you're using CR2005 or beyond, you can create a report based on data as long as it's held in one of the collection classes.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I'm using VS2008, so I think I'm using CR2008 !
|
|
|
|
|
I prefer Stimulsoft Reports
Data is very easy to set from C# objects and pricing is good.
|
|
|
|
|
I use two treeviews in my form.
These treeviews have the same nodes.
The thing that i want to do is if i scroll the scrollbar of first treeveiw,i want the scrollbar of the second to be moved automatically like first treeview.
I want to see the same nodes on first and second treeview if i scroll the scrollbar of the first or second treeview.
If u have any idea to do this, pls point me.
Thanks a lot.
axiom.kid
|
|
|
|
|
|
Thank for ur help.
The link u point me shows the thing what i want to do.Thanks
|
|
|
|
|
You can capture an event like onscroll with this[^]
and you can set new scrool position on second treeview by this[^]
|
|
|
|
|
Hi,
i have a problem with program icons. When i select a new icon for the program from application properties, build solution, copy the exe (with correct icon) to desktop, then the icon changes. I have other self-made programs on desktop as well, and the icon of the new program will become the same as the others when i copy it to my desktop. Why? Using Visual C# 2008 Express Edition, Vista
When i right click the exe, then in the properties it shows the correct icon.
Ty
|
|
|
|
|
The icon you set needs to contain icons in all the different possible sizes, or it will only be used for the sizes you provide.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
It contains all of the sizes. It works correctly on other computers where there are none of my other programs with custom icons.
As a matter of fact, it works correctly in all folders where there are no other programs of mine with custom icons.
modified on Friday, September 18, 2009 6:36 AM
|
|
|
|
|
Are you setting it on the Application tab of the Properties page of the project?
|
|
|
|
|
|
hi friend,
i have two thread which share the job(thread1,thread2). how do i terminate the thread1 from thread2. is this posible? and how to return the value form the thread
Thanks in advanced
Nishar A.
|
|
|
|
|
|
|
Hi All,
Im hoping someone can give me an idea on what I may be doing wrong (if anything). In my project I have a Combo Box which I populate from a SQL Database (using a Dataset and a for statement looping through each record). I have done it on form load and it works well however I decided to run it from a background thread so I become familiar with threads and for a few other reasons.
Anyway, i have done it using a Thread but I seem to have taken a very large performance hit. Without a thread, populating the combo box (on Form_Load) it takes about 1 second. With the Thread it takes about 6 seconds.
Im assuming since Im new with threads there is something obvious in my code that is wrong. Here is the relevant code in question:-
//Create Delegates for the Threads to Access The Forms UI
private delegate void UpdateComboBox(ComboBox cboName,string strItemToAdd);
Code in the Form_load Event
//Hide the Status Label
lblStatus.Visible = false;
//Start by Enabling the Loading Circle
//This is an indicator that the Background Thread is still running
//The Background thread is connecting to the database and populating the Combo Boxes
lblLoadingFormData.Text = "Loading Data";
lblLoadingFormData.Visible = true;
lcFormData.Active = true;
//Create the Thread which will Update the Combo Boxes
Thread thrPopulateComboBoxes = new Thread(this.PopulateComboBoxes);
thrPopulateComboBoxes.Start();
Code to Populate the Combo Box
private void PopulateComboBoxes()
{
//This Method will Populate the ComboBoxes on the Form
//Customers
ArrayList al = new ArrayList();
//Customers Combo Box
al = myDatabaseFunctions.PopulateComboBox("SELECT Name FROM tblCustomers ORDER BY Name ASC", "Name", "Customers");
foreach (string s in al)
{
this.Invoke(new UpdateComboBox(this.AddItemToComboBox),new object[] {cboCustomer,s.ToString()});
}
}
I know the issue is not with the Arraylist as this is the same sort of code I am using in a non thread and the performance is fine
Finally the code to add to Combo Box
private void AddItemToComboBox(ComboBox cboName, string strItem)
{
cboName.Items.Add(strItem);
}
Can any1 offer some thoughts as to why Im taking such a performance hit? Am I doing something wrong with the threads?
Thanks in advance,
Daniel.
|
|
|
|
|
When Invoke is called from a worker thread, it sends a windows message to the UI thread which then runs the delegate. You are doing this for each string in your results, which will be slow.
You could run the db call on a worker thread and then call Invoke once with the entire ArrayList to populate the ComboBox .
Also, you should probably use a thread pool thread for this, either directly or using a BackgroundWorker .
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Hi,
I didn't look at your code as it was unformatted, lacking PRE tags. However I think you should read this[^].
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi all, I have some issues on Registering event, If you have any idea on my implementation please help me …
private SHDocVw.InternetExplorer browser;
HTMLDocument document;
HTMLDocumentEvents2_Event DocEvents;
This Event Fires well, when ever I click on any link the event is fired no issue on that. But when I click on the Text box the focus losts.
browser = (SHDocVw.InternetExplorer)pDisp;
DocEvents = (mshtml.HTMLDocumentEvents2_Event)document;
DocEvents.onclick += new HTMLDocumentEvents2_onclickEventHandler(DocEvents_onclick);
To over come this issues I have just implemented from one of the articles like bellow
public delegate void DHTMLEvent(IHTMLEventObj e);
[ComVisible(false)]
public class DHTMLEventHandler
{
public DHTMLEvent Handler;
mshtml.HTMLDocument Document;
public DHTMLEventHandler(mshtml. HTMLDocument doc)
{
this.Document = doc;
}
[DispId(0)]
public void Call()
{
Handler(Document.parentWindow.@event);
}
}
browser = (SHDocVw.InternetExplorer)pDisp;
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)browser.Document;
DHTMLEventHandler Handler = new DHTMLEventHandler(doc);
Handler.Handler += new DHTMLEvent(this.myCallback);
doc.onclick = Handler;
but it shows the bello error.
Ambiguity between 'mshtml.DispHTMLDocument.onclick' and 'mshtml.HTMLDocumentEvents_Event.onclick
So I have changed from mshtml.HTMLDocument to mshtml.DispHTMLDocument
Now there is no compilation error but while excecuting it shows the bellow error
System.NotImplementedException , NotImplemented “\r\n”
Somewhat I got the information that we have to use mshtml. IHTMLDocument2 So I have used as bellow
public delegate void DHTMLEvent(mshtml.IHTMLEventObj e);
[ComVisible(true)]
public class DHTMLEventHandler
{
public DHTMLEvent Handler;
mshtml.IHTMLDocument2 Document;
public DHTMLEventHandler(mshtml.IHTMLDocument2 doc)
{
this.Document = doc;
}
[DispId(0)]
public void Call()
{
Handler(Document.parentWindow.@event);
}
}
DispHTMLDocument dispDoc = (mshtml.DispHTMLDocument)browser.Document;
mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2)browser.Document;
DHTMLEventHandler Handler = new DHTMLEventHandler(doc);
Handler.Handler += new DHTMLEvent(this.myCallback);
dispDoc.onclick = Handler;
public void myCallback(IHTMLEventObj evo)
{
}
Now this runs good, but no event is fired while I click on the browser
If some one has any observation on that please guide me how to go with this. I am able to use IHTMLElementCollection and add events for each and every IHTMLElement But I am not interest in loop through all the elements and register events for each and every elements, rather want to regisert an event for a Document and from that I want to identify which element is clicked.
There are type of approaches.W3C Document Object Event Model.and Microsoft Event Object Model.
I think we can achieve the issues using Event Register and Bubbling
I know little bit on concept wise but not able to implement
If some one helps me … then it will be helpful for many…
Plese free to post your comments on that
Thanks for every one (those who involves in it)
|
|
|
|
|
I use AxSHDocVw.AxWebBrowser on a form. It work fine.
|
|
|
|
|
|
Hello,
I've been coding projects in Java for some time now and decided to move to C#. I have some difficulty using the notifyall equivalent of Java in C#. Here's how I use it:
In Java when I make a multithreaded application I use the Wait() command to make the thread sleep, and at some point I use the notifyAll command which makes all threads in the wait state continue operation (from then on it's usually a race over which gets the resources first and the others become blocked again.
Now the closest thing I have found to this in C# is the AutoRaiseEvent and ManualRaiseEvent classes.
How my program works is: There are usually 4-8 threads running asking a question from the class by putting the question in the input queue, the class (called Handler) gets the next question and puts the answer in the outputqueue along with the code that identifies the original question.
Up to now I've been using something like this:
While {!myHandler.hasAnswer(myQuestionCode))
{
Application.DoEvents();
}
unfortunatelly this uses up a lot of the CPU so it has to change.
I tried the following:
While {!myHandler.hasAnswer(myQuestionCode))
{
RaiseEventObject.WaitOne();
}
and when the Handler produces the answer it calls RaiseEventObject.Set();
I tried using this with AutoRaiseEvent but then only one of the Threads triggers and usually it's the wrong one so it goes back to WaitOne() and nothing happens.
I am now testing the ManualRaiseEvent and altering my code to this:
While {!myHandler.hasAnswer(myQuestionCode))
{
RaiseEventObject.Reset();
RaiseEventObject.WaitOne();
}
but still I see a problem, what if two threads pass the WaitOne stage and then before the others can become unblocked (among them the one whose answer has been given) the event is Reset , can that happen? or when the Set() command is sent ALL threads unblock?
If the above happens isn't there a chance that the handler (the calculations it does don't take much time) will trigger the Set while one of the threads is in part of the loop other than WaitOne ? if that happens and the Reset triggers, will the Set be lost?
Can anyone suggest corrections to my code or some sort of alternative?
I'm sorry if I did not explain it correctly, English is not my primary language, I tried explaining it as best as I can.
Thanks in advance for any help
|
|
|
|
|
|
Thank you for the reply I tried coding all options mentioned in the article but it does not seem to work for me.
I've tried many solutions using the following code to test them:
private void button1_Click(object sender, EventArgs e)
{
Thread t1 = new Thread(DoWork);
Thread t2 = new Thread(DoWork);
Thread t3 = new Thread(DoWork);
Thread t4 = new Thread(DoWork);
t1.Start("1");
t2.Start("2");
t3.Start("3");
t4.Start("4");
}
public static void DoWork(object a)
{
while (true)
{
lock (key) {
while (block)
{
Monitor.Wait(key);
block = true;
}
}
Trace.Write(a.ToString() + "|");
}
}
private void button2_Click(object sender, EventArgs e)
{
for (int i = 1; i < 2000; i++)
{
Trace.WriteLine("-");
lock (key)
{
block = false;
Monitor.PulseAll(key);
}
}
}
(this is the implementation from the document that was linked)
what it shows is something along the lines of :
1234-
-
-
12-
123-
1234-
what I want it to show is this:
1234-
1234-
1234-
1234-
1234-
meaning that when the notify is sent ( the - in the printout) all threads wake up
did I just understand the article wrong?
|
|
|
|