|
is there a already established class or dll that would do the job ? i have noticed that the packets do send out of order sometimes.
The Code Project Is Your Friend...
|
|
|
|
|
hello i have a custom control with 2 buttons i need the control the raise an event with the parent only when 1 of the buttons is pressed. what is the proper way to do this?
any suggestions or a link to an article will be helpfull
thanks
|
|
|
|
|
You should make a custom event handle to your control.
The way to do this is to create a delegate and a evet handle to you control like this
public delegate void ControlButtonPressedHandle(object sender, EventArgs e);
public event ControlButtonPressedHandle ButtonPressed; and then create a method that invokes all your delegates
protected virtual void OnButtonPressed(EventArgs e)
{
if (ButtonPressed != null)
ButtonPressed(this, e);
} Once you have done al this you can add a delegate to you button to rise when it is clicked and invoke all you custom control delegates
private void button1_Click(object sender, System.EventArgs e)
{
OnButtonPressed(new EventArgs());
}
Finaly your control now has a button pressed delegate.
Hope this helps you.
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
and how would i use this to notify the parent that this happened?
|
|
|
|
|
into the paren constructor add the following
myControl.ButtonPressed += new ControlButtonPressedHandle(myFunction);
and into it's class add the following function
void myFunction(object sender, EventArgs e) {
}
this is what a delegate is for
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
I agree with you but why make your own delegate when you can use the normal EventHandler ?
|
|
|
|
|
i dont know what your talking about im using multiple buttons in a control and i only want the event to happen when a specific button is pressed
|
|
|
|
|
lol in that case double click on the button in the designer and write there your code
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
i used my own delegate because in my opinion it makes the code more inteligible, easier to understand when it evolves into a mass of characters that nobody can understand (not even me sometimes)
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
Hi
Programmers likes dividing their code to several DLL. However, is there any rules to divide the code? By function, by class or by other factors?
Thanks
|
|
|
|
|
ting668 wrote:
However, is there any rules to divide the code?
Yes:
1. When something is reused, it goes to a DLL.
2. When something needs to hide classes, data and references to other DLLs, it goes to a DLL. E.g., Data Access Layers - we have a rule where no project but the DAL should use a SqlConnection or an OracleConnection. When classes or data need to be hidden, but public to an assembly, we use the 'internal' keywork and put it on a DLL.
3. When the project is mature (i.e., we're on the optimization phase) and something is slow to load, and will not be used on the application startup, it goes to a DLL.
Yes, even I am blogging now!
|
|
|
|
|
you only use dlls if you wanna reuse that specific code and share it among more than one program and the rules varry depending on how you want the dll to be used you may for instance want to make some sort of graphics dll with might include several classes or you may just want a single class in your dll such as a simple custom control that you share between a few programs. they are also usefull if you want to update only specific portions of your software without updating the entire release. sometimes it may just be simpler to contain all your code within a single .exe file as it makes installtion easier becuase dlls need to be registered with the os and the more seperate compenents your program has to deal with the greater potential for error/corruption as well as problems with updating a dll and breaking the code in your exe known as "DLL HELL". i hope this helps
|
|
|
|
|
|
Yes, right!
What is the simplest installer for .NET?
-> Ctrl-C Ctrl-V
|
|
|
|
|
heyas all,
pretty simple question I would imagine...
<br />
static void Main(string[] args)<br />
{ <br />
int input = Console.ReadLine();<br />
<br />
whatTime(input);<br />
}<br />
Where the prototype for whatTime is:
public string[] whatTime(int);
How would I get this to work? I tried an explicit cast, but it didn't
like that neither.
help please?
thanks all!
"There are 10 types of people in this world; Those that know binary and those that do not."
|
|
|
|
|
Int32 has a Parse method that takes a string parameter or you can use the ToInt32 method of the System.Convert class.
Both will throw a FormatException if the string cannot be parsed (including empty strings), or an OverflowException if the value is < Int32.MinValue or > Int32.MaxValue . Int32.Parse will throw an ArgumentNullException if a null value is passed, whereas Convert.ToInt32 will return 0.
Charlie
if(!curlies){ return; }
|
|
|
|
|
ahh perfect, thanks charlie!
"There are 10 types of people in this world; Those that know binary and those that do not."
|
|
|
|
|
is .net assembly quicker than assembly i doubt it but im still having thoughts..
IM PROUD TO BE A GMAIL;
|
|
|
|
|
Theoretically, it could be, as ASM code would be fixed for a single machine and use profile, while .NET IL code could auto-adjust to conditions on machine that would be detected on application startup.
In practice, .NET IL code is several times slower (tipically 5~100 times) than hand-made ASM code.
Yes, even I am blogging now!
|
|
|
|
|
Even in theory i don't think that it could be. Out of interest what is your argument for that?
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
The standard arguments for that are, that the JIT could build asm code specific to the hardware the program is running on, like processor architecture, cache size and even transfer some calculations to the graphic card etc...
But I also think this will never happen, because the JIT would have to be 100x more intelligent than the best c compilers of today.
|
|
|
|
|
The two are very different actually. It wouldn't be fair to compare. Do a little research. If i had some time i would explain.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
...
I have 3 questions for the page break experts out...
...
When you develop very complex and large programs with thousands and thousands of functions and classes, at a certain point the page will actually become far to large or filled to write anymore code and you are prevented.
1.? Will a page break solve this problem?
2.? If yes to 1. then how do I put in a page break in so that this will not be a problem?
3.? If yes to 2. then is there code at the end of the 1st page and the beginning of the second page that would be required?
Thanks to any and all experts who answer!
demasoni.com
As we traverse through this thing called life with recursive thoughts we must allways beware of the pointers that will ultimately leave us dangling from a string on the end of a tree branch. ->
Elite ->
|
|
|
|
|
woah 1000's of functions, what are you creating an operating system?!?!
anyways if you mean by page braking like put seperate sources in seperate files then definatly since i have never witnessed 1000's of functions but surely everything will be a mess + the ide will probably take a long time to load the whole document
IM PROUD TO BE A GMAIL;
|
|
|
|
|
No, not separate files. All in one single file. I need everything in one single file for now. Later I will may break it up into smaller header files if possible but I want it in one file for now.
I need a way to actually break the page where you type the code in the IDE of C#. It should look like two or more pages somewhat like typing several pages in Word Perfect assuming that it is possible to do it in C# version MDE2002. I am not even sure if it will allow you to continue typing if you could break the code area into several pages but I would like to know for sure. Somewhere around 40,000 or 50,000 lines of code C# prevents you from typing anymore and I need many many more, 1000's of lines of code to complete the functions and classes that I need.
It is not an OS, but a very very complex calculus based mathematical piece of software with thousands of methods seperate from each other such that it requires it. An OS probably has millions of lines of code. I have seen GUI EXE files that are several megs in size so it is not uncommon for huge file sizes with tens of thousands of lines of code. Mine only has tens of thousands.
So, is there anybody with an answer for the following...
...
I have 3 questions for the page break experts out...
...
When you develop very complex and large programs with thousands and thousands of functions and classes, at a certain point the page will actually become far to large or filled to write anymore code and you are prevented.
1.? Will a page break solve this problem?
2.? If yes to 1. then how do I put in a page break in so that this will not be a problem?
3.? If yes to 2. then is there code at the end of the 1st page and the beginning of the second page that would be required?
Thanks to any and all experts who answer!
demasoni.com
As we traverse through this thing called life with recursive thoughts we must allways beware of the pointers that will ultimately leave us dangling from a string on the end of a tree branch. ->
Elite ->
|
|
|
|