|
hello haiquang,
i came to know that in c# we can create dynamically buttons and textboxes thru code ... without drag and drop from the toolbox....like wise i wish to know is it possible to create a form() dyanmically by writing the code....
Thanks
Tony
|
|
|
|
|
hello haiquang
i came to know that we can create Button and textboxes tru Code without drag and drop from toolbox.
likewise can we create a form() in such a manner by writing the code..
and not by adding from Projects -------> Add new Item --> C# WindowsForm.cs...............
Thanks
Tony....
|
|
|
|
|
Did you try the following way?
private System.Windows.Forms.Button btnEncodePath;
this.btnEncodePath = new System.Windows.Forms.Button();
//
// btnEncodePath
//
this.btnEncodePath.Location = new System.Drawing.Point(352, 19);
this.btnEncodePath.Name = "btnEncodePath";
this.btnEncodePath.Size = new System.Drawing.Size(75, 23);
this.btnEncodePath.TabIndex = 1;
this.btnEncodePath.Text = "Browse...";
this.btnEncodePath.UseVisualStyleBackColor = true;
this.btnEncodePath.Click += new System.EventHandler(this.btnEncodePath_Click);
this.Controls.Add(this.btnEncodePath);
It is very easy, please go to the InitializeComponent() method for more infomations.
Take SharePoint to new height
|
|
|
|
|
hello haiquang
the code u showed is for creating the button dynamically ?????
i asked abt creating a new form.cs() by clicking on a button.............
|
|
|
|
|
public void CreateMyForm()
{
Form form1 = new Form();
Button button1 = new Button ();
Button button2 = new Button ();
button1.Text = "OK";
button1.Location = new Point (10, 10);
button2.Text = "Cancel";
button2.Location
= new Point (button1.Left, button1.Height + button1.Top + 10);
form1.Text = "My Dialog Box";
form1.HelpButton = true;
form1.FormBorderStyle = FormBorderStyle.FixedDialog;
form1.MaximizeBox = false;
form1.MinimizeBox = false;
form1.AcceptButton = button1;
form1.CancelButton = button2;
form1.StartPosition = FormStartPosition.CenterScreen;
form1.Controls.Add(button1);
form1.Controls.Add(button2);
form1.ShowDialog();
}
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.form(VS.71).aspx[^]
|
|
|
|
|
Okay, when you click on the button the code below will open a new form. First, create an event handler for the button you want to click on, and then type the following inside the event handler:
Form MyNewForm = new MyNewForm();
MyNewForm.Show();
That's all there is to it. If you would like to know how to go about setting the properties programatically for your new form write back.
Hope this helps,
j.t.
j.t.
|
|
|
|
|
Hi, why dont you check the windows generated code? is as all there you know!
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Introduction
Encode PHP is a tool to encode any php file
Every body can use it
Inside The Service
Click to the Encode button:
private void btnEncode_Click(object sender, EventArgs e)<br />
{<br />
try<br />
{<br />
string LogFileName = "Log.txt";<br />
FileInfo fi = new FileInfo(LogFileName);<br />
fi.Create().Close();<br />
StreamWriter writeLog = new FileInfo(LogFileName).CreateText();<br />
string encodePath = this.txtEncodePath.Text.Trim();<br />
string decodePath = this.txtDecodePath.Text.Trim();<br />
if (!(string.IsNullOrEmpty(encodePath) || string.IsNullOrEmpty(decodePath)))<br />
{<br />
new IEncodePHP(writeLog).GetFileInDirectory(encodePath, 1, decodePath);<br />
MessageBox.Show("Congratulation you encode successfully!", "Congratulation");<br />
}<br />
else<br />
{<br />
MessageBox.Show("Can not encode the source path!", "Warning");<br />
}<br />
writeLog.Close();<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show("Can not encode the source path: " + ex.Message, "Warning");<br />
}<br />
}
Encode Method:
private string EncodePHP(string strEncoded)<br />
{<br />
string variable1 = IRandom.GetRandomString(4, false, false);<br />
string variable2 = IRandom.GetRandomString(3, false, false);<br />
string variable3 = IRandom.GetRandomString(2, false, false);<br />
string startVariable = " $" + variable1 + " = '";<br />
string endVariable = "';";<br />
string strDecode = "$" + variable3 + " = '$" + variable2 + " = base64_decode($" + variable1 + "); eval($" + variable2 + ");';";<br />
string strEval = "eval($" + variable3 + ");";<br />
strEncoded = startVariable + strEncoded + endVariable + strDecode + strEval;<br />
return strEncoded;<br />
}
|
|
|
|
|
Is this a question, or the start of an article ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Yes, it is a start of an article
|
|
|
|
|
U R DOING IT WRONG!
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Hello,
If I call a (pure) C++ function from C# (using P/Invoke), and that function throws an exception, how will it be received in C#? Would it be wrapped into an object of Exception or one of its descendants?
Thank you.
|
|
|
|
|
I doubt it would be in a form that you'd hope, unless it's a COM exception. But yes, I imagine you'd get an exception that includes any message
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I tried it real quick. On the C# side I get a
System.Runtime.InteropServices.SEHException
Message == "External component has thrown an exception."
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
hello all
How to call another compiler(ttxp compiler for TTCN3) from within c#
and pass the arguments to that compiler from c# for it's execution
thanks
|
|
|
|
|
Process.Start.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
My console program use Marshal.GetActiveObject to get MS Outlook instance that I run with Method Process.Start. (Because I need to add some command-line parameters).
This program works correctly when I run at server. But when I try to use ASP page to run this program, GetActiveObject doesn't work.
In my program, I try to deactive Outlook window so I can use GetActiveObject. But all window handle that I got from my program at server is Null. I think this may be the cause of problem.
What should I do to solve this problem ?
|
|
|
|
|
ASP, or ASP.NET ? We have forums for either.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
ASP.NET just a caller to my console program. (Using Process.Start) But the problem is in my C# console program.
|
|
|
|
|
Hello,
I have done remoting on lan only, now i need to update this on web.
I want to connect the remote computer on web but i dont know how to make connection.
I have the mac address of the remote computer, is it useful to make the connection?
Will you please help me out or can you give me some idea about it?
It is desktop application.
Thank you.
|
|
|
|
|
hello krinaljariwala
window aplication and Webapplication is as a whole diffeent concepts.
window aplication are standalone applications....
Webapplication needs the server and at different threads the pages are on the destop of clients.......
mac address of the remote computer ??? how will u be sure that address
on loging we get an address which is temporary and after some time if congestion happens the n/w address is changed....
Thanks
Tony
|
|
|
|
|
See What i need to do is from my pc i want to connect to the another pc which is on web and i want to access that pc remotely.
Now i dont have any idea abt the connection of these two computers.
And which address is needed either mac address or ip address to make the connection.
|
|
|
|
|
A MAC address wont help you on the internet...
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
their kung-fu is weak
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|