|
You need to call the Initialize method after InitializeComponent
Public Class1()
{
InitializeComponent();
Initialize();
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
how to validate the function on the front end in c# throe coding its important and urgent
|
|
|
|
|
aadikadain wrote: its important and urgent
Not for me.
जय हिंद
|
|
|
|
|
Don't get your question.
Generally you can validate a textbox as
if(String.IsNullOrEmpty(textBox1.Text))
MessageBox.Show("TextBox is empty");
You can also use the Validate event.
Another option is ErrorProvider.
Thanks,
A.m.a.L
|
|
|
|
|
Thank you Amal for posting that code snip. It helped me solve a little problem that I have had with validating textboxes.
|
|
|
|
|
Hi,
In my website I hv written JavaScript in which i want to assign one variable's value to session .
Please, give me solution .
Thank you.
|
|
|
|
|
|
Hi,
I hv written that JavaScript in c#.net code behind page.By using this.RegisterStartupScript .
Can u plz give me solution 4 this?
thank u.
|
|
|
|
|
There is an ASP.Net forum too.
I dont think this can be done as Session is a server side variable and script executes at client. Not sure though.
जय हिंद
|
|
|
|
|
Hi All,
I want to create the context menu at run time based on the value picked from DB,Please help me...
Regards,
Lalit Narayan
|
|
|
|
|
Use ContextMenu class.
जय हिंद
|
|
|
|
|
Hello ,
Can anyone help me...?
I want to know As Applications (Ms Word, Excel, Photoshop,..etc) can open files in two ways:
either using OpenFileDialg-like dialog,
or by opening them when user in a file manager double clicks a file (that the application knows how to open - MsWord opens files with "doc" extensions, Photoshop opens "psd",... etc).
I have created an application using c# .Net (Windows Application).
I want MY APPLICATION to be able to open file in this way: that is without using [open file dialog].
I managed to "associate" particular file extension (let it be "abc") to be opened by my application,
when the file (with "abc" extension) is clicked the program starts - but I dont know how to get the full path to the file in order to open it.
So, currently the program is executed upon double-click - but the program does not open the file clicked.
I know how to open the file, but I must know which file to open. This is the problem.
I would expect also an event that would be fired if the program would be already running, and a file (with "abc" extension would be clicked in windows explorer
(or any other file manager)) .
Thanx n Regds
Kapil
|
|
|
|
|
You have to parse the command line arguments. For WinForms it is in Program.cs file. Initially your main function must be something like that:
static void Main()
{
Application.EnableVisualStyles();
Application.EnableRTLMirroring();
Application.Run(new Form1());
}
You have to change this method, to parse the command line arguments, because when you double click a file that is associated with your program windows basically sends the file name as an argument. For example:
myapp.exe C:\myfile.txt
Your main function must be changed to something like that:
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.EnableRTLMirroring();
if(args.length > 0)
{
Form1 frm = new Form1();
System.IO.StreamReader myFile = new System.IO.StreamReader(args[0]);
string line = "";
line = myFile.ReadToEnd();
frm.textBox1.Text = line;
myFile.Close();
Application.Run(frm);
}
else
Application.Run(new Form1());
}
The above code is just an example which reads a text file or one with an extension that you want to use into textBox1.
I hope this example helps you to solve your problem.
Nuri
|
|
|
|
|
Thank you very much Nuri.....
It really worked.
Thank you very very much...
|
|
|
|
|
How to blink label in C#.Please let me know the solution
thanks in advance
|
|
|
|
|
Use Timer with small time duration. Toggle the visibility of the label in the Tick event.
जय हिंद
|
|
|
|
|
d@nish wrote: Use Timer with small time duration. Toggle the visibility of the label in the Tick event.
...but don't do it unless it is realy important because you will annoy the heck out of your users.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Blink means Visible and False in a Interval.
If you can think then I Can.
|
|
|
|
|
Use Timer object and set label fore color different from its orignal and then set it orignal color,it will look like blinkin..
|
|
|
|
|
Hello,
I have a main form with a button that opens another form. But after it open it i can't return to the main form without closing this form. What do i need to write so i could return to the main form without closing the second form?
BTW - How, where and why do i need to do the form dispose?
|
|
|
|
|
Use Show() instead of ShowDialog() .
जय हिंद
|
|
|
|
|
OK. I will use form2.show();
When i close this form and want to open it again it writes an error exception says: "Cannot access a disposed object. Object name: 'Form2'."
What do i need to do to make it work?
|
|
|
|
|
Can you post the code how you are doing this?
May be you are using a class level object for Form2 and calling Show method in button click event. You need to create object in the click event itself. Like this:
private void button1_Click(object sender, EventArgs e)
{
Form2 o = new Form2();
o.Show();
}
जय हिंद
|
|
|
|
|
Ok,
I wrote before the "Form2 form2 = new form2();" not in the method of opening the form (button method) but outside in the class .
If i write it in the method it works but the problem is when i click the button of this form opening couple of times it opens again and again this form2 (i have many form2 opened).
I thought to use "if..." to check if form2 is already open and this way it won't open it again and again.
But maybe there is another way to prevent it?
|
|
|
|
|
Use Application.OpenForms property to check if the form is already opened. If it already open, just bring that to front and set focus.
जय हिंद
|
|
|
|