|
On the OnLoad event of the parent form do the following.
private void OnFormLoad(object sender, System.EventArgs e)
{
ChildForm f = new ChildForm();
f.MdiParent = this;
f.Show();
}
|
|
|
|
|
Does it work?
In your way, you have to set this.isMdiParent = true;
Then its appearance will change. I do not think it is a good method.
ps: can you give me some idea to make a logo. many thanks!
|
|
|
|
|
Hello again
I'm currently developing a simple IRC client and right now I have to decide whether to use Regex or normal String methods to parse the incoming data. The incoming data looks like this and has to be parsed serveral times a second in frequently used IRC channels:
:Nicky!u001@s1.bouncer.ca PRIVMSG #asdf :Hello everybody :)
This is my code - it works and is easy to maintain, but how fast is it compared to using String methods like IndexOf(), Substring() etc?
string pattern1 = @"^:(?<nick>.+)!(?<user>.+)@(?<hostname>[^\s]+)\s(?<command>\w+)\s(?<channel>.+)\s:(?<text>.+)$";
MatchCollection mc = Regex.Matches(cmd, pattern1);
if(mc.Count > 0)
{
for(int i=0; i<mc.Count; i++)
{
GroupCollection gc = mc[i].Groups;
if(gc.Count >= 6)
{
nick = gc[1].Value;
user = gc[2].Value;
host = gc[3].Value;
cmd = gc[4].Value;
channel = gc[5].Value;
text = gc[6].Value;
}
}
}
modified 12-Sep-18 21:01pm.
|
|
|
|
|
String size: how big is the string? If it's only a few chars, IndexOf is faster. If it's a few KB, Regex can be several times faster.
Don't forget to create compiled Regexes.
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
length is about 50-500 characters and has to be evaluated about 1-20 times a second
modified 12-Sep-18 21:01pm.
|
|
|
|
|
On a decent machine, I'd bet you'll not see much difference (if your Regex does not backtrack a lot) after the first invocation (the Regex engine will need to compile your Regex on the first invocation), but also depends on the position on the string your matches will be and if you're able to build a 0 backtrack regex.
For small matches on small strings (as it seems your case), I'd suggest you to use non-greedy operator (e.g., instead of using .* use .*?).
If you have parser construction and compiler construction knowledge, the best performing solution will alway be producing a DFA parser with a parser tool like COCO/R or using a parser generated by ANTLR, specially if your grammar is LL(1).
I see dead pixels
Yes, even I am blogging now!
|
|
|
|
|
Ok thanks, I think I will try both methods and watch what's faster, but I think I'll stick with the regex.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I like your code. That's text book use of regex.
/\ |_ E X E GG
|
|
|
|
|
It really is? I haven't used regex in complex programs so far.
Thanks!
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hello All:
I am trying to find a way to send email notifications through my windows service. Can someone please help me with this? Thanks a lot.
|
|
|
|
|
What is the best way to secure the Configuration Settings (app.config and web.config). It seems that one way to do it is to encrypt the contents of the Configuration Settings, especially the database access string, using a two-way encryption algorithm. This encryption can either be performed from our own code (using the Cryptography library) or through the Configuration Settings App Block. However in both cases we have to deal with an encryption key. Anybody that can get access to this key will be able to decrypt the encrypted strings. The question is where to store that key. Storing the key in the code does not seem to be a good idea, especially since it is easy to read the code contents through the disassembler. Does anybody know how to protect that encryption key or any other way to protect the configuration settings.
|
|
|
|
|
Hi,
I have a main form in my application and this form has a button. When the button is clicked, a new form is loaded - form A. Form A has another button, when clicked it loads form B. When form B is loaded I need the name (header) of the main form to change to included the name of form B. Since main form's properies are private, is there way of changing main form's text when clicking event occures in form A. I guess I can define a public property in the main form class to set it's text, is there any other way?
thank you
Felix
|
|
|
|
|
felimonchik wrote:
is there any other way?
Sure, I'd just pass the MainForm instance around to each form constructor.
FormA formA = new FormA(this);
...
public FormA(MainForm mainInstance)
{
mainInstance.Text = "you've loaded form A now!";
}
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Who is Jewish, the Trivia Game!
Judah Himango
|
|
|
|
|
Is this an MDI application or a group of SDI apps? Have you looked into the Model-View-Controller pattern?
|
|
|
|
|
It's an MDI application.
Thanx
|
|
|
|
|
I think Text property of a windows form is public. So u can directly assign to it.
Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
|
|
|
|
|
Hi there,
Does ne1 know what type of control is used in Skype chat for the Contacts?
How can i mimick it? ie. There is a name and when i click on it it expands revealing more details?
Thanks a million
|
|
|
|
|
Hai
Datacolumn col;
col=new DataColumn();
col.ColumnName = "Remarks";
ds.Table[0].columns.Add(col);
I have created the Datacolumn Dynamically by using above code i need to place the datacolumn As First in Dataset DataTable. Is it Possible . help me
|
|
|
|
|
I'm not sure this question belongs on this forum but I'll try it here.
I would like to query Active Directory for all of the Exchange Servers that it is aware of. I'm kind of a beginner. I believe there is only one Active Directory per domain. So, hopefully there is a way of querying AD for all the Exchange Servers in that domain.
How do I do it?
I've tried using system.DirectoryServices. It doesn't seem to give that to me?
Got any ideas?
|
|
|
|
|
hi to all,
i have a listview control with the property checkboxes set to true, in this listview i have two columns and the second column is editable.
on doubleclick event i autorise the editing on the second column only, but when the user doubleclick in the cell the state of the checkbox change (from checked to unchecked and vice versa)
all i want is to check and uncheck the check box of each item only if the user made a single click in the check box. in other word i want to desactive the checking and uncheking on doubleclick
best regards and thanks in advance
fady
|
|
|
|
|
I have received the following error a few times now :-
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at test.tmrTimersTimer_Elapsed(Object sender, ElapsedEventArgs e) in C:\test\test.cs:line 1717
I have read how to enable JIT Debugging (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtskEnablingJust-in-TimeDebuggingForWindowsForms.asp[^]).
I have created MyApp.exe.config, machine.config with the following
?xml version="1.0" encoding="utf-8" ?<br />
configuration<br />
system.windows.forms jitDebugging="true"<br />
configuration
NOTE < and > have been removed to allow posting
I have placed them in the same folder as my .sln file and also in the same folder as .exe. But it does not seem to work. By the way I am using a setup project to install this applicaiton is there anything special I have to do in the setup project to allow JIT debugging on the installed machine?
Anyone have any idea what I am doing wrong? I would like to enable JIT debugging permanently.
Thanks,
Liam
|
|
|
|
|
Hello gurus,
I would like to know how to avoid the "blur" effect when stretching an image with the DrawImage method of the Graphics class?
When I double the size of my image I wish the pixel's size being doubled. Is that possible?
If so, how? can I have an example please?
Best regards.
There is no spoon.
|
|
|
|
|
Hello
Yes, it is possible. Look at Gpaphics.InterpolationMode property. You need to set it to InterpolationMode.NearestNeighbor before drawing your image.
With best regards,
Andrew
|
|
|
|
|
ok, this works
Thanks
Best regards.
There is no spoon.
|
|
|
|
|
How do I get the WinForm to recognize my generic class (part of the project)
when a button event is fired in the WinForm?
class GenericClass
{
private int x;
private int y;
GenericClass(int _x, int _y)
{
x = _x;
y = _y;
}
//On the WinForm I want to load x and y above with input from two text boxes
OnButtonAdd
{
//WHAT CODE GETS THE TEXT BOXES TO SET x AND y? HOW TO INSTANTIATE
// A GenericClass OBJECT AND THEN ASSIGN THE NUMBERS IN THE TEXT BOXES?
//KEEP GETTING COMPILER ERRORS.....
}
Many Thanks In Advance
|
|
|
|