|
Using the clipboard like that is not good practice. What if the user has something in the clipbaord that they want to be there?
What's so bad about saving a temp txt file to open with notepad?
|
|
|
|
|
If I save the file and open it in a notepad after this, when the user do save, the file is saved in that location, and this is what i want to prevent. I want that notepad, when the user chose to save that text, to open a save dialog, and to ask the user the name/location for that file.
And about the clipboard.... the things stocked in it are temporary, and supposedly are not so important! (or can be recovered at any time)
|
|
|
|
|
Hi,
I'm having a problem with generics and reflection, trying to create an instance of a System.Action<> delegate and invoking it. I'm doing this:
Type type = typeof( Action<> ).MakeGenericType( new Type[] { typeof( string ) } );
So far so good. However, I can't figure out how to use Activator to create an instance of this so I can invoke it. The constructor for Action<> takes a "void (string) target", and I don't know how to express this in a call to Activator.CreateInstance. I.e., following the line above:
System.Delegate del = (System.Delegate)Activator.CreateInstance( type, new object[] { what_goes_here? } );
Anyone have a clue how to achieve this?
|
|
|
|
|
Search this message board for "Activator" using the "search comment" button.
Luc Pattyn
|
|
|
|
|
I'M a c# and java programmer and i wanna specialized in two category
symbian c++ and web services but i have low experiance and i wanna some1 help me from where i can start in both fields
articales or ebooks or recommendation for sites
plz plz plz ream my mail and send reply
|
|
|
|
|
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.
|
|
|
|