|
thanks a lot )
i'm going to try it
|
|
|
|
|
Hi!
I created an appliction with C# to display a large mount of text.
I thought richtextbox control might be a nice choice, but it seems it is not.
I wote my code like this:
public void AppendText(string myMessage)
{
this.richtextbox1.AppendText(myMessage);
}
When I ran my simulation, I got more than 2000 messages coming all the time. Each message is about 2 - 30 rows. The code doesn't work when those 2000 messages were coming. My application was just hanging there and took 100% of CPU.
Then I tried with InvokeMember(). I created a new class called MessageWriter which has a static method called
WriteMessage(string msg). In my form, I changed the code to:
public void AppendText(string myMessage)
{
Type myType = typeof(MessageWriter);
myType.InvokeMember("WriteMessage", BindingFlags.InvokeMethod, null, null, new object[]{myMessage, this.richtextbox1});
}
public static void WriteMessage(string msg, RichTextBox rtb)
{
rtb.AppendText(msg);
}
But unfortunately, this code doesn't work neither. Updating of the richtextbox is far too slow. My application has no time to do anything else.
How can I make richtextbox to update itself quickly! How can I solve this problem?
I am looking forward for your suggestion.
Best regars
Maruko
|
|
|
|
|
Maruko S wrote:
When I ran my simulation, I got more than 2000 messages coming all the time. Each message is about 2 - 30 rows. The code doesn't work when those 2000 messages were coming. My application was just hanging there and took 100% of CPU.
With good reason, you aren't letting the app do anything else. If you want to get some small bit of responsiveness you need to let the application process other messages. To do this put in some calls to Application.DoEvents() in your loop that is processing those 2000 messages.
Maruko S wrote:
Then I tried with InvokeMember().
InvokeMember is just going to slow it down even more, at worst you're incurring another lookup to find the WriteMessage method, at best you have another layer to go through to do make the call to the RichText box's AppendText method.
Maruko S wrote:
How can I make richtextbox to update itself quickly!
My suggestion...batch some of those updates together. Rather than updating 100 times a second (far faster than most people can comprehend) update 3-4 times a second. You can also try Application.DoEvents as I described above.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Hi!
Can anyone please verify that this is indeed a VS .NET bug?
Recipee:
Create a C# Windows Forms project
Add a Menu with a few items
Add an AxMediaPlayer (COM Component)
Place it inside a panel
Bug:
The IDE does not run the Menu. F5 creates the app but
not the menu. In design time, if you click on the Menu icon
in the guiless items tray (bottom), the Form shows the menu.
Click on the form and the menu disapear.
Is it me, heh ???
Thanks !
Antoine
|
|
|
|
|
Some calendars are not supplied in .NET framework.Can somebody guide me ,How to implement custom calender,Any article or library or suggestion?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
http://www.codeguru.com/forum/showthread.php?s=&postid=746030#post746030
|
|
|
|
|
i have a standard treeview control with checkboxes, how can i check all the children of a node when the parent is checked? i already have events for before and after check so i assume it must go in there but the problem i have is finding which node is selected as a node doesn't have to be selected for it to be checked.
Does anyone have any ideas as its really starting to annoy me as i know it must be so simple
Thanks
|
|
|
|
|
fixed it, i use e.Node to get the children and as its in the event afterCheck, it acts recursively to check all the children!
|
|
|
|
|
check this
TreeView, by recursion you can check anything you want
http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=b650f7fb-147d-4326-8d83-cb51d89a4ca5
|
|
|
|
|
OpenFileDialog type:
I am trying to send Intel hex file to target memory to one of my hardware .
I add (buttonOpenFile) in one of my application to send a file (SendFile) .
The code look like one below.
public void SendFile(FileStream fs)
{
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, (int)fs.Length);
Send(buffer);
}
Now I put the following in my button click handler:
private void buttonOpen_Click(object sender, System.EventArgs e)
{
FileStream fileh = new FileStream(@"C:\Skole\p01.hex", FileMode.Open, FileAccess.Read);
BaseTerm.term.SendFile(fileh);
fileh.Close();
}
The above code work without any problem, but I wish to create an instance of System.Windows .Form OpenFileDialog type
to return a Stream that represents the specified file selected by the user.
--------------------------------------------------------------------------------------
I tried to write the code to do the job, but I do not know how to write the last pieces of code.
I will be grateful if you could help me.
private void buttonOpen_Click(object sender, System.EventArgs e)
{
OpenFileDialog myOpenFileDialog = new OpenFileDialog();
myOpenFileDialog.InitialDirectory = "c:\\Skole\\" ;
myOpenFileDialog.Filter = "hex files (*.hex)|*.hex|All files (*.*)|*.*" ;
myOpenFileDialog.FilterIndex = 1 ;
myOpenFileDialog.RestoreDirectory = true ;
if(myOpenFileDialog.ShowDialog() == DialogResult.OK)
{
Stream myStream = null;
if(( myStream = myOpenFileDialog.OpenFile()) != null)
{
??????????
??????????
}
}
}
Salam Hamid
|
|
|
|
|
Change SendFile to accept a Stream type instead of a FileStream type. Then, pass the stream object received from the dialog-use code.
John :D
|
|
|
|
|
Thanks John it works finally..
Salam
|
|
|
|
|
Hi, all.
I want to paste pictures that have been pasted in Excel.
When I "Copy & Paste" from other tools(MSpaint, MSPhotoEditor etc...),
the format in Clipbord is "Bitmap etc...". So, I can paste it by next code.
Bitmap bmp = (Bitmap)d.GetData(DataFormats.Bitmap)
But, from Excel, the format are "MetafilePict, GIF, PNG, etc... ".
Please help me how to convert(cast) these formats into "Bitmap".
|
|
|
|
|
Hello,
Since I'm a trully begginer in .NET technology, I need advice for
the following problem:
I developed a windows service, who has the meaning to
perform complex processing, over some data. Itself is an
independent application.
The data came from users of a web site (file uploads, or
HTML posts). A web service read the data and save it in files,
on harddisk. The windows service, use FileSystemWatcher to monitor
the arrival of data, and when a new file is there, start to process
it.
The question: is this a good way to implement data exchange
between web service and windows service? I mean, does not
exist other ways to Interprocess-communication/data exchange?
The reason I have concerns is that under heavy stress, the
filesystemwatcher could behave badly, I know it have some inertia...
Does anybody could point me to another kind of "watcher" to use? Some
global events or ... what else??? I really have just a partial knowledge
about .NET capabilities, so any advice is wellcome.
Regards,
Don Miguel.
|
|
|
|
|
If all you're looking for is a different file watching mechanism, you can try this: Store the names of the files you've already processed (if you delete or move the file you just processed, that'll work too). Then, instead of subscribing to the file system notifications, get a directory listing and see which items are new. (If you need to see changed files, store the timestamp and compare those as well.) Now that you have a list of files to process, go ahead and run through them. Update your list of processed files, wait x seconds, and repeat.
If you were wanting to decide on a completely different way of getting the data, you'd need to tell us a lot more information. Do you have control of the application creating the files? Are these on the same machine or separate? How much data is coming through? How often does new data arrive? How critical is it that every single bit of data be processed? Must they be processed in order? Etc.
Have fun finding the answer!
John :D
|
|
|
|
|
Hello John,
First of all, thanks a lot for your time.
You are absolutely right, I can list myself the files which are new,
so I will not depend on file watcher event. (but I really liked the
event notification style...)
But also, I want some advice about different mechanisms to receive data. The application which create the data is on different server, and the single way I thinked to pass data to my windows service was through a file. But first tests, reveal a much lower performance as expected,
so sure another mechanism could help, at least if it bypass harddisk operations.
I don't have control over the application which create the data. I just know it can output a stream of data, in text, xml, or binary. I know the
format. It can send data over network sockets.
As a must, data have to be processed in order. The chalenge for developers, is to find the fastest way for all above communication.
The .NET framework is new for almost all of us, so feedback from
experienced people, which faced real performance issues, is greatly
appreciated.
Thanks again,
Don Miguel
|
|
|
|
|
If you have no control over the application generating the data, then your solution is less difficult to find. Choose the option provided by that application which is likely to be the fastest. Learn what that requires, then research/learn/ask how to implement that in the platform/language needed.
John
John :D
|
|
|
|
|
Finally, found the proper solution, if anyone interested:
- using native Win32 interprocess comunication methods. Unfortunately,
it took me years to finally conclude that this is the true solution.
I hoped, and hoped, and hoped... but now, after .NET 2.0 arrival, and
looking at the plans for next version, I can safely advice anyone having
the same problem: use native way!!!
|
|
|
|
|
I placed a transparent panel over the meidapalyer, but i do not know why it does not work. I have tested it on normal panel, it works perfectly.
any expert have ideas on that?
thanks in advance
henry
|
|
|
|
|
I've two problems right now:
Problem 1.
I am prepare some report printing on my own. They are simple, so I work on it myself. In a file I just define some strings, and the positions to be print out in a page. However, I don't know how to define the unit ?? It will be printed in a PrintDocument either directly to the printer or in a PrintPreviewDialog. What I can get is the graphics to Draw the strings, will it be the same when using in print preview and actual priniting ??? Should I use hundredth of inch as the unit or pixel, or point as the unit ??
Problem 2.
In a DataSet containing two tables "Order" and "OrderDetail" and a relation "OrderRelation". "Order" is displayed in one form, while "OrderDetail" is displayed in another form. The controls in these forms are databound to the SAME dataset. Order Form controls bound to "Order" table, Order detail form controls bound to OrderRelation. However, in Order Form, I moved to next item, the OrderDetail form is still showing the detail items for the first Order item. How can I solve it ?
Hiya, Everybody ^^
|
|
|
|
|
I need to present one of those nice Authentication boxes to get a Username and Password and then 'do something' with the info - think of it as Windows authentication, but using my own authenticator instead of the Windows one.
Now, my thinking is that in the Page_Load() function, I can take a look to see if the Basic Auth token is there, and if it isn't, return the challenge. If it is there, I can test it and allow the username/password through to the
page if its ok.
Does anyone have code for this?
-Adrian
|
|
|
|
|
Form2 f2=new Form2(this);
f2.show();???
|
|
|
|
|
And your question is?
Daniel E. Blanchard
|
|
|
|
|
Hi,
I would like to know how to compile the entire C# ASP.NET Application via CommandLine csc.exe, without using VS.NET.
I tried to run the same. But since some files would be redundantly placed in folders like _vti_cnf etc, Compiler is refusing with some duplicate definition errors.
I have one more doubt...
If there are more number of files, how to pass all files to csc.exe and then configure csc.exe to compile to just a single dll by name of application, just like how VS.NET does. (Like ASP.NET application is deepak, then all files need to be compiled to deepak.dll in BIN folder). I am afraid if there are any restrictions to the length of commandline being spawned.
Please advise...
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
I am using a DataSet to store the rows that I am working with. I have been able to add and delete records, but I can't figure out how to simply update a record. Any help would be great.. I'm not sure what other information to give here.
Any help would be great
|
|
|
|
|