|
No, I meant if the time is 12:10:02, you set your timer for 8 seconds, so that when it fires for the first time, you're on the 10 second interval. But, I suggested you calculate that interval every time, b/c you don't know how long your code takes to execute ( and I have even less idea, I don't know what it does ), so you'd need the code to keep auto correcting to stay on the 10 second markers.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: you don't know how long your code takes to execute
Yes, because of that time calculation can be going wrong. Thanks for the explanation.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hi, i have a memory stick and store anyexe file in it. I'd like to know how to run exe file automatically in a stick when it is opening. Looking forward to ur reply. (email- zdliana@gmail.com)
zodingliana
|
|
|
|
|
Hi, i have a memory stick and store anyexe file in it. I'd like to know how to run exe file automatically in a stick when it is opening. Looking forward to ur reply.
|
|
|
|
|
You do that by putting an autorun.inf file on the memory stick.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How to disable Form close option (X Box).
Truth Is The Simplest !!!!
|
|
|
|
|
Handle the Closing event?
But, really, other than asking "Are you sure?" you should allow the user to close the application.
|
|
|
|
|
Why not just remove it ? You can do that in the form properties in the designer
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
ThankXXX..Christian Yes i want to remove but there is no property available.
If it is there pls let me know.
Truth Is The Simplest !!!!
|
|
|
|
|
It's the 'Control Box' option.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Removing the control box gets rid of minimize and maximize too.
This method just disables the close button and the Close menu item in the form's context menu. Make sure that you give the user a clean way to close the form though!
public Form1()
{
InitializeComponent();
EnableMenuItem(GetSystemMenu(this.Handle, false), SC_CLOSE, MF_GRAYED);
}
private const int SC_CLOSE = 0xf060;
private const int MF_GRAYED = 0x0001;
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern int EnableMenuItem(IntPtr hMenu, int uIDEnableItem, int uEnable);
Edit: I should add - to enable it again if you need to declare this constant:
private const int MF_ENABLED = 0x0000;
and the code to perform the enable is:
EnableMenuItem(GetSystemMenu(this.Handle, false), SC_CLOSE, MF_ENABLED);
Dave
modified on Friday, February 22, 2008 6:14 AM
|
|
|
|
|
Just tested it; it works, but Alt+F4 still closes the form.
|
|
|
|
|
Forgot that one! The code below handles that
private const int WM_SYSKEYDOWN = 0x0104;
private bool handleAltF4 = true;
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
{
if (msg.Msg == WM_SYSKEYDOWN)
{
switch (keyData)
{
case System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4:
{
return handleAltF4;
}
}
}
return false;
}
Dave
|
|
|
|
|
I finally got around to trying that, I doubt I'd ever need it, but it's good to have, thanks!
|
|
|
|
|
Hey guys!
I just wanted to invite you to download my new development app, it is called CodeForms Lite v4.0, it's compatible with Delphi, C#.NET, VB.NET and VB6, please send me your comments about it, you can donwnload it for free from this address:
http://www.neuronlabs.com/download.html
It is FULLY FUNCTIONAL and IS NOT a limited time demo!
Enjoy it!
Regards
Rafael Agundis
|
|
|
|
|
So, write an article...
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi, I'm playing around with a form and I want it to know if I've changed the contents of a combo box (selecting a new index that is, it doesn't take text extry) placed on it.
So I just made a global bool variable 'ComboBoxChanged' initialized as FALSE, and I set it to TRUE upon handling the ComboBox.SelectedIndexChanged event.
The problem I have is that the event is triggered when the form is loaded, thus setting my 'ComboBoxChanged' variable event though I haven't actually selected a new index.
What do you guys think is the best solution to this?
Thanks for any help.
|
|
|
|
|
Don't use global varuables ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
When the combo box is being populated, the selected index changed is fired on every item (don't ask me why). So you may need another form wide variable or in your inherited combo box to keep track of whether the combo box is being populated.
|
|
|
|
|
An easy work around for this is to set enabled to false before populating it then to true when it's finished. You can then check the enabled state in the SelectedIndexChanged and only alter your global variable if Enabled == true;
Dave
|
|
|
|
|
hi frnds,
I have a requirement for serializing an object to XMLDocument Object. I have got few examples of converting a class with few properties to a simple XML as below:
Class:
class Person<br />
{<br />
private string strName;<br />
private int iAge;<br />
<br />
public String Name{<br />
get{ return strName; }<br />
set{ strName= value; }<br />
}<br />
public int Age{<br />
get{ return iAge; }<br />
set{ iAge= value; }<br />
}<br />
}
XML:
<Person><br />
<Name>Anthony</Name><br />
<Age>38</Age><br />
</Person>
Now the problem is that my XML is not this simple. It would be something like:
<Company>
<Name> </Name>
<Employee>
<Name>A</Name>
<Age>1</age>
</Employee>
<Employee>
<Name>B</Name>
<Age>2</Age>
</Employee>
..
..
..
</Company>
Do we need to use composition here?? Any suggestions??
Thanks
Keep DotNetting!!
GeekFromIndia
|
|
|
|
|
geekfromindia wrote: composition here
yes
class Name
{
string First;
string Middle;
string Last;
};
class Employee
{
Name Name;
int Age;
};
class Company
{
string Name;
List<Employee>
}
Silence is the voice of complicity.
Strange women lying in ponds distributing swords is no basis for a system of government. -- monty python
Might I suggest that the universe was always the size of the cosmos. It is just that at one point the cosmos was the size of a marble. -- Colin Angus Mackay
|
|
|
|
|
ahhz wrote: class Company{ string Name; List<employee>}
I am using 1.1 here so Name and Employee will be classes instead of string or generic list.
maybe something like
class Company<br />
{<br />
Employee objEmployee;<br />
Name objName;<br />
}
but i m still not sure how it can be initilialized with multiple employees?
Property with Employee Array??
Keep DotNetting!!
GeekFromIndia
|
|
|
|
|
class Company
{
string Name;
Employee[] employeList;
}
Silence is the voice of complicity.
Strange women lying in ponds distributing swords is no basis for a system of government. -- monty python
Might I suggest that the universe was always the size of the cosmos. It is just that at one point the cosmos was the size of a marble. -- Colin Angus Mackay
|
|
|
|
|
public class Person<br />
{<br />
string m_Name;<br />
int m_Age;<br />
}<br />
<br />
public class Company<br />
{<br />
string m_Name;<br />
[XmlArray(ElementName="Employee", Namesapce="...")]<br />
Person[] m_Persons;<br />
}
only two letters away from being an asset
|
|
|
|