|
string.Format("{0:X5}", 16)
Will produce 000A0 .
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
Oh, I messed that up, I did what I always do, I googled it ( I can't remember the format specifiers at all, I use them so rarely ). I event forgot the {0: } bit.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Ed.Poore wrote: Will produce 000A0
only if your fan broke down; 00010 is what I would expect.
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.
|
|
|
|
|
*phew* so, two out of three of us got it wrong. I don't feel so bad now, although mine was still the worst.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Luc Pattyn wrote: only if your fan broke down
Funny you should say that...
Speaking of fans, could do with a few more around the place to keep the house nice and cool...
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
seeing it has been rather hot here today, either you or your CPU could be running hot as well in the UK...
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.
|
|
|
|
|
Tell me about it, spent yesterday (now it's the morning) out in Brentwood doing some coaching. Skeet vest was black so not the best of colours...
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
Thanks Ed, works fine.
I still can't find it in the documentation though
|
|
|
|
|
http://msdn.microsoft.com/en-us/library/txafckwd.aspx[^]
Look under the "Format String Component" heading and there's links to how to specify numeric, date and enumeration format codes. Did you really try to look? Quick Google and away it went (albeit I knew where I was going...)
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
I usually use Yahoo, need to try Google more often.
|
|
|
|
|
You're the one who still uses Yahoo ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
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)
|
|
|
|