|
namespace Sample
{
public partial class Form1 : Form
{
}
// create a separate class here
public class mySeparateClass
{
public static int globalVariable=new int();
}
}
Once you have done that, u can access the variable globalVariable, anywhere in all the forms of the project using the classname as follows.
mySeparateClass.globalVariable
try it.;)
Keshav Kamat
India
|
|
|
|
|
Global variables are generally an indication of a poor design. If you feel compelled to use a global variable your first thoughts should be: Is there a better way to do this? If not, then fine, use the global variable. But they should not be your first option.
|
|
|
|
|
|
Please show me how to creat a variable that can use in all form in my project.I'm learning C#.NET 2005.
|
|
|
|
|
create a separate class like below
public class mySeparateClass
{
public static int globalVariable1 = new int();
}
then you can use the variable globalVariable1 as mySeparateClass.globalVariable.
check it out.
i hope this works.
Keshav Kamat
India
|
|
|
|
|
Declare a variable as static
public static int myvar=1;
|
|
|
|
|
Hi
We create application which was used webdav method
using this we fetch mails from exchange server for a particular mail id (like xxx@uuu.com)
We fetch Inbox Mails and Sent Items folder mails and insert into two tables (sql server)
My problem is, I want relate to Inbox Mail and Sent Item Mail
If One mail is come from in my inbox
say like "New Mail.EML"
when i reply to "New Mail.EML"
it stored in sent items folder as "RE:New Mail.EML"
i want how to find relationsship between NewMail and RE:NewMail
Which Property in webdav method , to determine this relationship
Expecting Earlier answer
By
Arun
|
|
|
|
|
I have create one xml from one dataTable.
DataTable dt=new DataTabel();
.................
oleDbCommand1.CommandText = "SELECT * From ss";
adapt = new OleDbDataAdapter(oleDbCommand1);
...............
adapt.Fill(dt, "one");
dt.WriteXml("dei.xml");
the xml is like this:
<one>
<unu> string <\unu>
<\one>
<one>
<unu> double <\unu>
<\one>
<one>
<unu> float <\unu>
<\one>
i need to create :
<one>
<unu> string <\unu>
<unu> double <\unu>
<unu> float <\unu>
<\one>
-- modified at 4:54 Wednesday 14th March, 2007
|
|
|
|
|
Add this datatable to a dataset names one. Then use dataste writexml method..
I am not sure..It's a wild guess
|
|
|
|
|
no works that
|
|
|
|
|
I'm a beginner. I opened a new form and want to close old form. But I don't know how to close old form. Help me!
Thank you everybody.
|
|
|
|
|
|
You can hide the old form
Form2 form=new Form2();
this.Hide();
form.Show();
... but it is a problem if you close the form2 the program run in background
|
|
|
|
|
ya so when form2 is closed,
please use a similar piece to show any other form, from which u can proceed.
Keshav Kamat
India
|
|
|
|
|
if you want to close the application you need to use
Application.Exit();
|
|
|
|
|
Don't close the form where static void main is there. Entire application will be closed !!!!!!!!!!
|
|
|
|
|
Hello All,
While creating a database, i have to issue the following command.
CREATE DATABASE Logger1 ON PRIMARY (Name = test_data, filename ='C:\\mydb_data.mdf', size = 3, maxsize = 5, filegrowth = 10%)log on (name = mydbb_log, filename = 'C:\\mydb_log.ldf', size = 3, maxsize = 20, filegrowth = 1)
Please note that the max file size while creating the mdf file is 5MB and the max file size while creating the ldf file is 20MB.
I dont want to restrict it to a finite value.
By default when a database is created through GUI, it has an unrestricted file size.
so in the same way, can someone please tell me what should I provide as maxsize to have unrestricted growth.
any help would be useful
Keshav Kamat
India
|
|
|
|
|
Keshav V. Kamat wrote: can someone please tell me what should I provide as maxsize to have unrestricted growth
I wasn't aware that you had to supply a max size value. Just leave it out.
|
|
|
|
|
hey thanks man.
it just got the default value, ie. unrestricted growth, which i wanted.
Keshav Kamat
India
|
|
|
|
|
Hi Please help us,
I have a captcha images with me and the images have noise(means some horizontal and vertical lines to protect Captcha image from OCR software).So please tell me how can remove the noise of the image.
Regards,
UdayKiran.
|
|
|
|
|
I think the point is that you are not supposed to be able to remove the noise by software. The only reason I can think of to ask this question is how to get around a captcha image in order to spam a site.
|
|
|
|
|
I must call another application from my C# application (Windows forms).
I am searching the code corresponding to the "system" command I used before in the normal C language.
Thank you in advance.
Patrick Meinguet
|
|
|
|
|
Play with System.Diagnostics namespace
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Great, I used the System.Diagnostic.Process to start another process.
Thank you for your help, and sorry for the late answer.
Patrick Meinguet
|
|
|
|
|