1
Reply

Simple question about button text property

Islam Mohammed osama

Islam Mohammed osama

Jan 12 2006 1:24 PM
1.9k
Hi,I am trying to create a button and assign its text property programmaticaly and my code is stated below. But I am receiving an exception telling me: // An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in system.windows.forms.dll Additional information: A generic error occurred in GDI+. // Here is some details about what I am trying to do: -I overloaded the constructor of the form to receive a struct array(I) each containing a string array(Info) -I intend of making more than one button,one for each element of the struct array with its text property assigned to the fifth string after I clear this of course. -I tried the debug mode,the exception is thrown after the full excecution of the code,right after the application.run -Here is my code in the overloaded constructor of the form, it is called by another button in a different form: b=new Button(); b.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(178))); b.TabIndex=0; b.TabStop=true; b.Location = new System.Drawing.Point(104, 512); b.Size = new System.Drawing.Size(112, 40); string t=I[0].Info[5];//<--just a string t=t.ToLower(); b.Text=t; please reply soon,THANKS.

Answers (1)