|
Try to use the code below
Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru").
43 68 65 65 72 73 2c
4d 69 63 68 61 65 6c
|
|
|
|
|
Hi.
How can I determine the amount of free space and total amount of space at a drive using the .NET classes?
Regards
EnkelIk
|
|
|
|
|
declaration:
using System.Runtime.InteropServices;
[DllImport("kernel32", CharSet=CharSet.Auto)]
static public extern bool GetDiskFreeSpaceEx(
string lpDirectoryName,
out Int64 lpFreeBytesAvailable,
out Int64 lpTotalNumberOfBytes,
out Int64 lpTotalNumberOfFreeBytes
);
usage :
Int64 freebytes = 0, totalbytes = 0, totalfreebytes = 0;
GetDiskFreeSpaceEx(@"c:\\tmp", out freebytes, out totalbytes, out totalfreebytes);
Warning : 64-bit output.
if you start putting in too manay features, it no longer remains useful for beginners
quote in a CP article comment, shiraz baig
|
|
|
|
|
StephaneRodriguez wrote:
Int64
Just curious; any particular reason you are using Int64 instead of long? So far I haven't had to deal with a situation where I needed a 64 bit number so please enlighten me of any problems
James
Sig code stolen from David Wulff
|
|
|
|
|
No problem until now. I want to make sure those who use interop functions such like GetFreeDiskSpaceEx know that the result is not 32 bits. You probably know that GetFreeDiskSpace() raised a lot of problems for us 32-(bit people, as this API method was there before huge drives came in the market.
if you start putting in too manay features, it no longer remains useful for beginners
quote in a CP article comment, shiraz baig
|
|
|
|
|
I attempted to use this function in J# but the compiler issues this message:
'Cannot resolve name 'System.Runtime.InteropServices'
How can I solve this problem?
Thanks
Arash
Arash Afifi
Software Engineer
Fax: +1(309)276-7070
E-mail: afifi@sympatico.ca
|
|
|
|
|
try
import System.Runtime.*;
From an MSDN doc I have just seen, this looks like the right syntax.
if you start putting in too manay features, it no longer remains useful for beginners
quote in a CP article comment, shiraz baig
|
|
|
|
|
I am trying to configure my firewall to allow access to my .NET remoting application. I set my firewall to route tcp traffic on a particular port to my internal PC. This works fine for instance if I run a web server on my machine (port 80) but I cannot get my .NET remoting server exposed. My port scanner says the correct port is open. I am simply opening up port n to TCP traffic. ANy suggestions?
Joel
|
|
|
|
|
|
Your link didn't seem to point to a relevant thread. My server is a simple server with no call backs to the client. I thought that if you configure the server to listen on one port that would be all it needed. If it needs more ports, how do I know which ones.
Thanks - Joel
|
|
|
|
|
Just to see what happening (if anything similar to this) try opening up a command window on the server and run netstat to show you a listing of all the TCP connections.
Hit your service and then see if there are any connection attempts outwards on another port.
|
|
|
|
|
I found the problem and it has nothing to do with open ports. When using CAO in remoting, the server sends the IP of the server back to the client which it then uses to get back to the server. When using a firewall, the IP sent to the client will often be the internal IP which is not the IP that the client can use to get back to the server. So you have to override this in the config file for the server with something like:
<channel ref="tcp" port="5555" machinename="firewall.something.com">
Joel
|
|
|
|
|
I need to add an Outlook toolbar to a .NET form? Does .NET come with such a feature? If not is there a free way to do this or must a component be purchased? If a componentmust be purchased does anyone recommend one for C++ .NET forms?
Many Thanks,
Derek
|
|
|
|
|
Take a look at this project
http://www.codeproject.com/cs/miscctrl/outlookbar.asp
|
|
|
|
|
Has anyone else had problems trying to attach on to a web service while your IE proxy setting sare set up for auto-discovery and to use a configuration script?
It seem sthat I have to set my proxy settings for an explicit proxy server address in order to use any webservice.
|
|
|
|
|
|
Yeah, leppie was wondering about that type of stuff so I posted it in the C# forum...probably should have said it here too...
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
I just had a thought as I was drifting off to sleep and can't seem to come to a conclusion why it would work out, but I also can't seen to decide just how it COULD work. Let me explain.
When developing a windows forms application that gathers some information by accessing a web service, you have to first start by creating a web reference in the solution. That much I understand.. Here is where my mind goes crazy...
What happens if I deploy the web service on a machine that is named differently than my development box? Does the application somehow find the new location of the webservice? I doubt that...
I have a feeling that, just like using the fancy database wizards to create connections to a SQL database, I have stubled upon a major 'flaw/feature' of the VS.NET IDE. It seems like ALL of these things require that you develop on the same machines, or at very least machines with the same names, that will be used in production.
Am I nuts or just missing some big picture here?
|
|
|
|
|
Ray Cassick wrote:
Am I nuts or just missing some big picture here?
Ray Cassick wrote:
I just had a thought as I was drifting off to sleep
It is the Drifting Off To Sleep Thoughts Demon at worka gain
If you think about it this kind of problem has existed since before web services, before the internet etc. With a client/server database setup you would always have problems if the server location changes.
And just as with the connection wizard for SQL you can go into the generated code and change the location or rather assign it to an app setting.
So I would not call it a "major flaw", just one of the "wizard tradeoffs" really.
Won't it be nice though one day when we can use a proper URL for our in-dev web service and then just flick a switch once it is ready for prime time? No uploading, configuring, changing app settings and all that other crap which drives me up the wall.
|
|
|
|
|
Paul Watson wrote:
It is the Drifting Off To Sleep Thoughts Demon at worka gain
Yeah, hate it when that happens... The one night I decide to get to bed early too...
Paul Watson wrote:
Won't it be nice though one day when we can use a proper URL for our in-dev web service and then just flick a switch once it is ready for prime time?
Well they should at least allow us to use a DSN for the database stuff. Why they don't allow the wizzards to reference a DSN is way beyond me... would solve that problem right there.
Hmm that's not a bad idea.. DSN for a webservice... I wonder if I could set up a local DNS entry that points to the web service directly...
|
|
|
|
|
Ok, I have a link here that fixes what seem to be ALL my issues regarding development configuration vs. deployed configuration...
Clickety[^]
It outlines propper use of the application.config and user.config files...
Great stuff, but should be MUCH simpler to find IMHO.
Hope it helps someone in the future.
|
|
|
|
|
Hi Code Gurus,
(in a C# Windows Form application) How can I detect that the Enter key was pressed in a single line TextBox control in .NET? I want to enable the user to type in some text in the TextBox (a command) then by pressing Enter an action is taken (like the address bar in IE). This can be done very easily in VB and VC++. But in .NET, the only way I discovered so far is to use a multi-line textbox control and detect when the user presses Enter (using either KeyDown or KeyPress events) then remove the new line characters from the text, this is other than deleting any multine text pasted in the control except the first line. I believe there must be a better and more elegant way to do this but I just don't know it!
Regards,
Waleed
(a.k.a. Wal2k) www.wal2k.com
|
|
|
|
|
If you're going to ask this in one forum, please don't ask it in another. Cross posting is really frowned upon here. Just FYI before someone else who's in a really bad mood decides to jump down your throat...
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
Hi Code Gurus,
(in a C# Windows Form application) How can I access a public member of the form that defines the static Main() member function from another form? I have two forms, frmMain (defind in frmamin.cs) and frmDialog (defined in frmDialog.cs), I want to access a member of frmMain (a property or a function or whatever member) from within frmDialog. When the application runs, the frmMain form is displayed as the application's main window, if the user chooses Connect... from the application's menu, the other form frmDialog is displayed as a dialog using ShowDialog(), now what I want is to access some member fields of frmMain from within frmDialog while frmDialog is displayed as a dialog box (that was extremely easy in VB).
Well, to be more specific, what I want to do exactly is to enable the user to connect to a database, when the user selects Connect... from the menu, a dialog box is displayed to allow the user to enter the database connection information. There is an OleDBConnection object (public member), defined in frmMain, that I want to use in frmDialog (there is a button in frmDialog whose caption is "Connect"). In the event handler of that button I want to use the public member of frmMain (System.Data.OleDB.OleDBConnection m_OleDBConn). For example like this:
myfrmMain.m_OleDBConn.ConnectionString = ... etc
Regards,
Waleed
(a.k.a. Wal2k) www.wal2k.com
|
|
|
|
|
This is an extremely common question for people migrating from "classic" VB to .NET, as a result of the confusion caused by the way VB doesn't differentiate between the form class and an instance of the form.
The simple answer is that you have to provide a reference to the instance of your frmMain to the instance of frmDialog:
class frmMain : System.Windows.Forms.Form
{
public System.Data.OleDb.OleDbConnection m_OleDBConn;
...
private void Connect()
{
frmDialog D = new frmDialog();
D.Parent = this;
D.Show();
}
}
...
class frmDialog : System.Windows.Forms.Form
{
...
public frmMain Parent;
public void OK_Click(object sender, EventArgs e)
{
Parent.m_OleDbConn.ConnectionString = ... etc;
}
}
A better approach would be to show frmDialog as a dialog, and use public properties on frmDialog to retrieve the information in frmMain. For example:
class frmMain : System.Windows.Forms.Form
{
private System.Data.OleDb.OleDbConnection m_OleDBConn;
...
private void Connect()
{
frmDialog D = new frmDialog();
if (D.ShowDialog() == DialogResult.OK)
{
this.m_OleDBConn.ConnectionString = D.ConnectionString;
}
}
}
...
class frmDialog : System.Windows.Forms.Form
{
...
public string ConnectionString
{
get
{
return this.txtConnection.Text;
}
}
}
|
|
|
|