|
hi ,
anyone know how add events to the titlebar of a windows form ?
for eg , if i click on titlebar only titlebar shld be visible and the rest of the form hidden.and clicking again unhides the form ,like that .
Thanks for u'r time
|
|
|
|
|
You can use the WndProc for the form and filter the a combination of the following events:
private const int WM_NCLBUTTONDBLCLK = 0xA3;<br />
private const int WM_NCLBUTTONDOWN = 0xA1;<br />
private const int WM_NCLBUTTONUP = 0xA2;
When the event fires you can change the size of the form that received the event. If the form height is lessthan or equal to 0 then change the height to the normal height. If the form height is the normal height then reduce the height to 0.
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
how can i make a rollover menu that shows submenus when rolled over - like the green top right menu here on codeproject.com - when rolling over the "Message Board" menu for example it opens the submenus (windows vista,visual C++,Alt/WTL/STL,COM,C++ etc.).is it possile with Dreamweaver? or generally what code should i write.
tx.
|
|
|
|
|
Would this be better suited in the asp.net forum?
Regards,
Thomas Stockwell
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.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
i have a windows service which spans athread whne started
protected override void OnStart(string[] args)
{
Thread mythread= new Thread(new ThreadStart(Run));
mythread.Start();
}
it makes a webrequest(webmethod) in every 10 seconds but sometime i get an exception(only some times) there was not enough thread pool to complete the opertaion why do i get this mesage and what should i do remove this.
thank you
|
|
|
|
|
How to check that I'm connected on the internet with C#.
Help.
Vasildb
|
|
|
|
|
Register the event in the class
System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += new System.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
and in the event handler check for the Internet availability
void NetworkChange_NetworkAvailabilityChanged(object sender, System.Net.NetworkInformation.NetworkAvailabilityEventArgs e)<br />
{<br />
if (!e.IsAvailable)<br />
{<br />
MessageBox.Show("N/W DISCONNECTED"); <br />
}<br />
}
|
|
|
|
|
This will work, but it is really only going to show if you are connected to the network. This can be different than being connected and able to hit the internet.
You would also need to use a WebRequest or the Ping class and attempt to access a URL that you are reasonably sure will always be available.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
#region Required for internet connection - testing!<br />
[DllImport("wininet.dll", CharSet = CharSet.Auto)]<br />
static extern bool InternetGetConnectedState(ref ConnectionState lpdwFlags, int dwReserved);<br />
<br />
[Flags]<br />
enum ConnectionState : int<br />
{<br />
INTERNET_CONNECTION_MODEM = 0x1,<br />
INTERNET_CONNECTION_LAN = 0x2,<br />
INTERNET_CONNECTION_PROXY = 0x4,<br />
INTERNET_RAS_INSTALLED = 0x10,<br />
INTERNET_CONNECTION_OFFLINE = 0x20,<br />
INTERNET_CONNECTION_CONFIGURED = 0x40<br />
}<br />
#endregion
#region Process - Check internet connection state<br />
private void checkInternetConnection()<br />
{<br />
ConnectionState Description = 0;<br />
<br />
if (InternetGetConnectedState(ref Description, 0))<br />
{<br />
this.tsEmailLabel.Text = "Internet Connection is present.";<br />
this.tsEmailLabel.ForeColor = System.Drawing.Color.YellowGreen;<br />
}<br />
else<br />
{<br />
this.tsEmailLabel.Text = "Internet Connection is not present.";<br />
this.tsEmailLabel.ForeColor = System.Drawing.Color.Crimson;<br />
}<br />
}<br />
<br />
#endregion
Works for me.
Glen Harvy
|
|
|
|
|
Thanks. That works.
Vasildb
|
|
|
|
|
HI,
I must formatting one String like VB6. How I can make?
Es.
Label1 = Format((Num - (Num \ 60000) * 60000) / 1000, "00.000")
Thanks
|
|
|
|
|
// assuming int Num;
double seconds=(Num%60000);
label1.Text=seconds.ToString("00.000");
Luc Pattyn
|
|
|
|
|
The formatting does not work correctly… if I set the number with .ToString(“00,000”) the result is always "nnnnn,000" ("n" is the integer number) … Why?
|
|
|
|
|
Because you are using a comma instead of a period in the formatting string. The period specifies the position of the decimal marker, regardless of what decimal marker is used.
---
Year happy = new Year(2007);
|
|
|
|
|
Thanks ..
|
|
|
|
|
First, let's make the VB6 code better:
Label1 = Format((Num Mod 60000) / 1000, "00.000")
Then we can translate it into C#:
Label1 = ((Num % 60000) / 1000).ToString("00.000")
---
Year happy = new Year(2007);
|
|
|
|
|
The formatting does not work correctly… if I set the number with .ToString(“00,000”) the result is always "nnnnn,000" ("n" is the integer number) … Why?
|
|
|
|
|
Because you are using a comma instead of a period in the formatting string. The period specifies the position of the decimal marker, regardless of what decimal marker is used.
---
Year happy = new Year(2007);
|
|
|
|
|
Thanks a lot ...
|
|
|
|
|
Guffa wrote: Because....
Don't you just hate repeating yourself.
|
|
|
|
|
sw.WriteLine("<body>"); <br />
sw.WriteLine("" + row["columnName1"]); sw.WriteLine("</body>")
The value columnName1 in this case is a static value. how can i make it dynamic? In my case, i have to give variable column names stored in an ArrayList.
sw.WriteLine("" + ArrayList[i]"]);
This gives an error in SQL that ArrayList doesn't match any column name in the database
|
|
|
|
|
Just replace the static string value with whatever you like:
sw.WriteLine("" + row[names[42]]);
Saira Tanwir wrote: sw.WriteLine("" + ArrayList[i]"]);
This gives an error in SQL that ArrayList doesn't match any column name in the database
Hardly. That code doesn't even compile...
---
Year happy = new Year(2007);
|
|
|
|
|
sw.WriteLine("" + row[names[42]]);<br />
I've already tried this. It doesn't work for me. Any other suggetions....??
|
|
|
|
|
No, there aren't any other suggestions, as that is how you do it.
If you want any help with the code that didn't work for you, you have to show it.
---
Year happy = new Year(2007);
|
|
|
|
|
You could iterate through the columns in the same way you do for the rows. Something like this:
sw.WriteLine("<body>");
foreach (DataRow row in myDataTable.Rows)
{
sw.Write("<p>");
foreach (DataColumn column in myDataTable.Columns)
{
sw.Write(row[column.ColumnName]);
sw.Write(" ");
}
sw.WriteLine()
}
sw.WriteLine("</body>");
|
|
|
|