|
Hello,
i have started a c# project in Visual Studio 2003 on a PC running Win2000. Now i have moved the project to a Win XP machine and use Visual Studio 2005 to continue. The problem is although the designer shows all the controls placed on the form (buttons, numericUpDown and so on) in the new XP style, the runnig programm still uses the style of windows 2000. Is there anywhere a setting that makes my programm look like a normal XP Application.
|
|
|
|
|
Add a call to Application.EnableVisualStyles in your main method:
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
I have a form that has several tab pages on a tabcontrol.
What I want to do is make sure that the user cannot tab/navigate to another tabpage whilst they are editing data on that tab page.
psuedo code:
EditButton_click event<br />
{<br />
this.tabpage1.locked = true;<br />
}<br />
<br />
SaveButton_click<br />
{<br />
this.tabpage1.locked = false;<br />
}
Any ideas.
TIA
Glen Harvy
|
|
|
|
|
Since Framework 2.0 the TabControl has a Selecting event that occurs before a tab page is selected and can be aborted. So you could set a boolean field inside the both click event handlers and inside selecting event handler abort the selection or not depending on the current value of the field.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks for pointing me in the right direction. I ended up with the following:
AddButton_click<br />
{<br />
this.tabControl1.Selecting += tabControl1_Selecting;<br />
}<br />
<br />
private void tabControl1_Selecting(object sender, TabControlCancelEventArgs e)<br />
{<br />
MessageBox.Show("Please Cancel or Save your changes before going any further.", "Action required", MessageBoxButtons.OK, MessageBoxIcon.Question);<br />
this.tabControl1.Selecting -= tabControl1_Selecting;
tabControl1.SelectedIndex = 2; <-- I'll code this to refer to the appropriate calling tab page index.<br />
this.tabControl1.Selecting += tabControl1_Selecting; // in case the user didn't get the message the first time :)<br />
}
Thanks for being there - I don't know what I would do without this forum.
Regards,
Glen Harvy
|
|
|
|
|
The Selecting event lets you abort the selection of a tab page in a much nicer way:
private void tabControl1_Selecting(object sender, TabControlCancelEventArgs e)
{
MessageBox.Show("Please Cancel or Save your changes before going any further.", "Action required", MessageBoxButtons.OK, MessageBoxIcon.Question);
e.Cancel = true;
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Makes sense to me now thank you
Glen Harvy
|
|
|
|
|
Hello Friends,
I want the name of process and username under which it is running.
Like wise in taskmanager ImageName and UserName.
Thanks in advance.
Rahul Kulkarni.
|
|
|
|
|
Hello,
What do you have or what do you know about the process?
All the best,
Martin
-- modified at 5:29 Thursday 22nd February, 2007
System.Diagnostics.Process class has a lot of usefull methods!
|
|
|
|
|
I know all using for loop we can get all the processes
running in the task manager in the following manner.
foreach(Process prc in Process.GetProcesses())
{
////We can get all information like id of process etc.
}
But i want the "username" also under which the process is running.
how to get user name.
Rahul Kulkarni
|
|
|
|
|
I have no idea how you can do this.
Good luck
|
|
|
|
|
|
Thanks Alooot.
It's Really cool.
Rahul Kulkarni
|
|
|
|
|
hi
how can i make the new form appear in the center of the window?
i double click on the previous form opens this new one.
|
|
|
|
|
Hello,
Forms property "StartPosition" will help you.
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
All the best,
Martin
|
|
|
|
|
thank you so much.
one more thing.
on executing my application, when i try to resize the form, ie, by dragging or using the maximise button, it gets resized but the controls dont get done. they are at the same position as of the original form.
how do i resolve this?
|
|
|
|
|
Hello,
Use the Anchor or Dock property of the controls.
All the best,
Martin
|
|
|
|
|
thank you. i could do it by setting the Dock property.
|
|
|
|
|
You have to appropriately set the Anchor and/or Dock properties of the controls.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
thank you. i could do it by setting the Dock property.
|
|
|
|
|
I am new to Visual studio 2005.
In previous versions of Visual Studio, whenever you build a web application in debug mode, automatically a dll of the application used to get added in bi\debug folder.
Now in 2005 how do we create this dll?
please let me know ASAP.
Nana
|
|
|
|
|
Hi,
I require to get a value of varaibale in whole project. How can I ?
For exameple, In starting of applicaton i initialize the variable's state. That i require on several Form. I cannot change the name of variable.
Any one tried this.Plz give me some hints....
Binod K.
|
|
|
|
|
Hello,
You could use a const or static variable.
//mainformcode
public const int constint = 100;
public static int staticint = 100;
public Form1()
{
InitializeComponent();
}
//other class
int i1 = Form1.constint;
//setting a const variable is not possible at this point (Form1.constint = 200, will not compile)
int i2 = Form1.staticint;
Form1.staticint = 200;
All the best,
Martin
|
|
|
|
|
Martin# wrote: You could use a const or static variable
A const variable? (const = constant, which means it doesn't change; variable meaning it does change)
|
|
|
|
|
You got me!
All the best,
Martin
|
|
|
|