The code you posted seems to be fine (it worked for my vs). Could it be that the Button2_Click() Method isn't called. Check the EventHandler for Button2 - there should be something like: this.button2.Click += new System.EventHandler(this.Button2_Click);
hooray
Posts
-
call function -
Change properties with buttonHey, as long as you are in the same class you can simply use pnlleft.BackColor = Color.Red; (same with the other panel) for the filemenu it is bit more complicate - the can only change the backcolor of one item - so the only way i know to change it all would be to go through every item.
-
Custom textbox with dropdownlist behaviorHey, the standard ComboBox already has this functionality in .NET 2.0. So there should be no reason to write a custom control for this behavior.
-
To Get Data from Clipboardthe problem here that you cannot set all data to the clipboard. the clipboard cannot handle all types of data. it can only handle data in the formats given in the enum DataFormats. example: string str = (String)iData.GetData(DataFormats.Text);
-
question about xml and C#yeah - that right.Thanks for the correction. that was my mistake because I only thought of the language specific umlauts.
-
question about xml and C#as far as I know does the xmlwriter nothing like this - because xml supports different encodings it is not neccessary to htmlEncode the string. But if you wish to use the HtmlEncode function you can use it the following way. string str = System.Web.HttpUtility.HtmlEncode("bye"); To have access to the System.Web Namespace you need to add a new reference (System.Web.dll) to your project.
-
Inheriting from System.IO.FileStreamthe mistake in your code is that you are trying to use the default contructor of the filestream class. But this constructor isn't accessible. A solution to this problem is just using another constructor of the filestream class. You can call other constructors via the base synonym(as you can see in the following code). class b : System.IO.FileStream { public b(string str): base(str,FileMode.OpenOrCreate) { } }
-
Access between classes?then you must use it as static like this: class ClassA { private static int i; public static int Property { get { return i; } set { i = value; } } } then you can use it via int i = ClassA.Property;
-
Access between classes?what use wrote in your code was the use of a static property. if you use ClassA.Property the property definition must be: public static int Proprty {...} But you can also use is this way you code it. But then you must create an instance of the class to use the property: ClassA c = new ClassA(); int Temp = c.Property;
-
owNetworkingthe easiest way to do this should be to use the TcpClient object. This object can connect to an IP and open up a stream. Then you can use a StreamWriter to write the chars into the stream.
-
Operator Overloadingmaybe this article helps: http://msdn.microsoft.com/library/en-us/cssample/html/vcsamOperatorOverloadingSample.asp
-
I don't know how to use RandomNumberGenerator class.The class RandomNumberGenerator is an abstract class - that means that you cannot create instances of this class. You can only create instances of class which extends the RandomNumberGenerator class. Then it should be no problem to use the member functions. (if you meant something different please tell and give some more info)
-
Validating a date in a DateTimePickersimply use the validating event with this event you can cancel the leave event via eventarg
-
C# & XML & nested loops problem (try 2)I think it should be easier to do the selecting via sql. If can't send mulitple sql-statements to the db you should try to get your data into a local Datatable object. Then you can query it locally via the Select method.
-
Starting services programaticallytry this: this.serviceController1 = new System.ServiceProcess.ServiceController("place here the name of the service"); serviceController1.Start();
-
combobox itemsin this case just use: label1.Text = combobox.SelectedText;
-
Change system localehow about putting this into the main CultureInfo ci = new CultureInfo("De-de"); Application.CurrentCulture = ci; the constructor of the cultureinfo accepts both - a string for the region or the code as int
-
URGENT!! Locking DataGrid Mouse Eventsnormally it should be enough to disable the control. dataGrid1.Enabled=false; this way no input reaches the control anymore
-
Open formthe @ means the special chars like '\' will not be interpreted. for example: @"c:\1.txt" == "c:\\1.txt" (for me - I just getting used to use it as standard) The Opacity could not be set to the value of 50. The Opacity is a float value - so if you like to reach 50% opacity you should set it to 0.5
-
in god sake help me iam sinking in deep blue seaThere is one problem in your code. All the code runs on one thread - so you just can handle one connection. To avoid this effect you should start one thread per client. At the point where you accept the socket you shoul openn a new thread and give it the socket. As a result the main thread isn't blocked anymore and can accept new connections. So it should be possible to handle multiple connections.