|
Yeah, the structure of the documentation on formatting strings isn't very transparant,
I often need to search around a lot. Here[^] is what you want.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
I tend to use number.ToString("X8") quite a lot.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Hello Everyone,
I'm in the process of making a simple Bézier Curve editor for a time-lapse photography project, and was wondering how to correctly implement different "update cycles" for the control. By "update cycles" I'm referring to when the user clicks something draggable and moves it about, causing the control to enter a cycle where it updates and redraws itself.
Currently, I've tried using a combination of the MouseDown, MouseUp, MouseClick and MouseMove events, but it's a ghastly sight to behold, and seems to reek of bad programming practice. In order to complete a single task, you have to jump between the four different events.
So is there a proper and cleaner way to accomplish this? I'm not very experienced with custom controls, so any help would be greatly appreciated.
Regards,
Brandon Walton
|
|
|
|
|
Hi,
this works for me quite often in such situations:
1. use whatever mouse and keyboard events you need to update the status, but don't redraw (at most set a flag "needs repaint".
2. have a timer (Windows.System.Forms.Timer) periodically (say 4Hz) check the flag and call Invalidate().
This decouples user manipulations and repaints, solving the problem of how often to repaint.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Awesome, so when a MouseDown event is raised it'll keep redrawing until the follow-up MouseUp event, ridding the program of the MouseMove and MouseClick events. Blah, I should have thought of that . Thanks for the help!
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Hi, i am wondering to know how can i establish an internet connection via coding in C#.NET ?
-no matter it uses APIs or .Net Classes!
-no matter it executes on the background (without the end-user's permission) or executes by asking from the end-user!
=======
i tried to use APIs in the MSDN Library :
[DllImport("Wininet.dll", EntryPoint = "InternetGoOnline")]
with different Entry Points that the MSDN provided there but any of them worked in the final!
i am using VS 2008 in vista Ultimate and examine the code above in the Xp Too
|
|
|
|
|
|
nope!
i'm so sorry that caused you think that way!
i mentioned in my post as you locked! and i told no matter if it ask the user for connecting to internet
Trojans ask users ? "Hi dear user i wanna steal your information can you please connect to internet cause i want to send your passwords and any of your pressed keys that i stored before! ha ?"
no my dear friend this application not virus,not Trojan, not anything bad else! but if you wondering to know that if i designed a virus and Trojan and a key logger and so more all in a little tiny program, my answer is yes! and in that application that was not necessary to connect to internet, it waits and when the user connected to internet then sends the information. this is for your interest!
i'll be so glad if you answer my pretty safe and legal question and if you don't know just follow this post maybe you can learn a little some more!
best wishes
|
|
|
|
|
Hi,
I am writing a small application that is used to investigate log files. Currently our QA teams are using TextPad for this task. My goal is to create an application that will be able to filter and search the log text for preset expressions.
The size of a typical log file is 2 - 3 MB, and contains about 30,000 lines.
I am using RichTextBox so I will be able to format text. I am using a StringBuilder to concatenate all the lines (note: I am using '\r\n" after each line). I then set the content of the stringBuilder to the RichTextBox:
textBox.Text += sb.ToString();
This causes the application to freeze. I tried SuspendLayout / ResumeLayout but as soon as the form is displayed the application freezes.
Limiting the lines to 10,000 prevents the freezing.
Any ideas?
|
|
|
|
|
Try adding the rows to a string collection. Although it's essentially what StringBuilder does it may help isolate the problem. i.e. is it StringBuilder or is it the TextBox that is causing the hangup.
List<string> lines = new List<string>();<br />
lines.Add(...)<br />
textBox.Text = string.Join("\r\n", lines.ToArray());<br />
only two letters away from being an asset
|
|
|
|
|
Do you need to display all the 30.000 lines, or can you suffice with the first 10.000 and a small warning label that says "only showing first 10.000 items"?
If the answer is "no", do your users need the ability to "edit" the text inline? If they don't, then consider using HTML for markup and showing it in a WebBrowser.
..or use a paging-pattern, where the user can view a limited amount of text on each page.
Good luck
I are troll
|
|
|
|
|
Hi,
IMO TextBox and RichTextBox are not the right choice for displaying thousands of lines of text. The reason is they need all text concatenated, and any change you apply needs to create a new huge string with new mark-up commands.
When text is line-oriented, hence does not need word wrapping, I tend to use a ListBox. That is a Control that holds a collection of strings, each representing one line of text. It does not mind holding millions of lines. By default a ListBox shows text in one font, one size, one style, one color; however it is rather easy to use the DrawMode.OwnerDrawn, so one can color each line individually (or do anything more fancy yourself) in the DrawItem event. Here is an example[^].
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Yoav Ben Zvi wrote: contains about 30,000 lines
Not something I've done, but if I were in your situation, I would consider subclassing the RichTextBox and adding some kind of virtual mode so it only has to deal with a small percentage of those lines at once - much like you can do with a ListView.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I understood that you want to have it read-only.
Probably discarding the TextBox and replacing it with e.g. a ListView [^] control in virtual mode [^] or a Data grid[^] (with one column then) would be the best way to go.
Or e.g. use a WebBrowser control to show the text.
|
|
|
|
|
Thanks for the replies. I experimented with the ListView - 30,000 thousand lines with no problem. Since most users will probably apply some heavy filtering, there shouldn't be any problem. I don't even have to use virtual mode.
I'll try out the datagridview to see which is easier to use.
|
|
|
|
|
Hi,
I need to know Split method of string. I have data in the string variable like following and i need to know, how may I split and directly convert into Arraylist or Dataset or DataTable ?
kindly give method with sample commands.
Thank you very much in advance
Sample Data
===========
apple,500,15.50,0000010105,good,A001
(Riaz)
|
|
|
|
|
MSDN[^] not good enough for you?
/ravi
|
|
|
|
|
You already know it's called Split , so what is your question?
|
|
|
|
|
string sample = "apple,500,15.50,0000010105,good,A001";
string[] sp = sample.split(',');
output:
sp[0] = "apple";
sp[1] = "500":
sp[2] = "15.50":
sp[3] = "0000010105":
sp[4] = "good";
sp[5] = "A001";
|
|
|
|
|
I guess he needs one step further. The requirement is to get an ArrayList, here's code snippet -
string sample = "apple,500,15.50,0000010105,good,A001";
string[] sp = sample.Split(',');
ArrayList arr = new ArrayList(sp);
foreach (object item in arr)
{
Console.WriteLine(item);
}
Hope this would help. 
|
|
|
|
|
Arindam Sinha wrote: ArrayList arr = new ArrayList(sp); foreach (object item in arr) { Console.WriteLine(item); }
no need for reassigning it in ArrList
we can use like this..
for(int i=0;i<sp.length-1;i++)
{
console.writeline(sp[i]);
}
<div="" class="ForumSig">Padmanabhan
My Articles:
Articles[^]
My latest Article:
Word Automation[^]
|
|
|
|
|
Yes I know. It was done only for the original request. He needs an ArrayList. 
|
|
|
|
|
Thank you very much friend
|
|
|
|
|