|
A better way is to use an IFormatProvider for the British CultureInfo . For example, String.Format can take an IFormatProvider as the first parameter. This could be the CultureInfo.NumberFormat for the CultureInfo for the English (Britain) culture. By default, such methods uses the Thread.CurrentCulture but as I've mentioned you can override this behavior by passing an IFormatProvider . This is the correct way, instead of assuming and managing custom format specifiers like the previous post mentioned.
For more information about localization and culture-specific formatting, see Developing World-Read Applications[^] in the .NET Framework SDK. With regard to your question, see Formatting Date and Time for a Specific Culture[^] under the previous topic.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Everyone,
I have been looking around the web for info on how to hide/disable the 'Start Button' in WinXP using C#. Have found a few references to doing it using other languages but nothing with C#. A lot of them seem to reference 'Shell_TrayWnd'. Is this possible in C#. Need it to lockdown pc. Have disabled a lot of the functionality I need by editing the System Registry using C# and this would be the final piece of the jigsaw. If there is anyone who knows how to do it in C# or any other way, say through the Registry, I would really appreciate your suggestions,
Regards,
John
|
|
|
|
|
This is not really a programming question if all you want to do is "lock-down" the OS (which, BTW, there is no documented registry hack for disabling the Start menu - it's pretty much required). If you want your program to work as a kiosk, you can implement a full-screen application (search the previous comments since this has been covered more times than necessary) and use system hooks to disable certain key combinations that allow users to bypass your application's handlers.
There are several articles here on CodeProject that deal with hooks and you can find more information about them in the Platform SDK. For one decent article, see Using Hooks from C#[^] or search CodeProject for additional articles.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
thanks for the reply. But I have found the following VB code to do the job. It just hides the Start Button (true/false values passed). It doesnt disable it as you can still press the windows button on the keyboard, but thats not a problem. Is there anyone who knows how to implement this code is C#, or can I place it in the C# project as is an call it someway??
#####################################
'
' Paste this into a Code Mode (BAS)
'
option Explicit
'
private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (byval hWnd1 as Long, byval hWnd2 as Long, byval lpsz1 as string, byval lpsz2 as string) as Long
'
private Declare Function EnableWindow Lib "user32" (byval hwnd as Long, byval fEnable as Long) as Long
public Sub EnableStartMenuButton(byval bEnable as Boolean)
'
' Don't forget to re-enable it !
'
Dim lHwnd as Long
'
lHwnd = FindWindowEx(0&, 0&, "Shell_TrayWnd", vbNullString)
lHwnd = FindWindowEx(lHwnd, 0&, "Button", vbNullString)
Call EnableWindow(lHwnd, bEnable)
'
End Sub
'
#####################################
Thanks Again,
John
|
|
|
|
|
You simply need to P/Invoke these functions, but again I warn you that this is not the correct way to make a kiosk application. If this is your goal, you should check out the Platform SDK in the MSDN Library at http://msdn.microsoft.com/library[^].
[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern IntPtr FindWindowEx(IntPtr hWnd1, IntPtr hWnd2, string class1, string class2);
[DllImport("user32.dll")]
private static extern void EnableWindow(IntPtr hWnd, bool enable);
public static void EnableStartButton(bool enable)
{
IntPtr hWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null);
hWnd = FindWindowEx(hWnd, IntPtr.Zero, "Button", null);
EnableWindow(hWnd, enable);
}
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hi there
i have an mdi form which has a few child forms
in the mdi form i have a status bar
how can i add text to the status bar from the child forms?
VisionTec
|
|
|
|
|
You simply need to expose the StatusBar (or better yet, the StatusBar.Text property for a better OO design in reference to encapsulation and protection) on the main form. Your child forms could so something like this, assuming that your main form (ex, MainForm ) had a String property called StatusText :
MainForm form = (MainForm)this.MdiParent;
form.StatusText = "Hello, world!" Honestly, how you provide access to status bar is completely up to your implementation. This is simply a matter of creating a good object-oriented design.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am trying to convert an old MFC GUI which fires off a continuously running C++ program into a C# GUI which will fire off a continuously running C# program. The former used two pipes to pass information back and forth. I cannot seem to find the .Net compliment of pipes in any of the .NET documentation. Any help would be greatly appreciated. Thanks...
|
|
|
|
|
|
Thanks so much. I knew that it could probably be done but I would have never found it. This looks like something I can certainly use.
|
|
|
|
|
I looked at the zip file which was referenced in the previous reply. It appears that the code simply creates the pipe process in MFC/C++ code which is then put into a DLL and imported into the C# program. Athough I am sure that this works, I was really looking for the C# compliment to pipe processing. Once my C# GUI process spawns my C# process, is there any way for the two to pass information back and forth. I am not very familiar with channels, threads, etc. so I don't know whether these would be my solution. Once again, any assistance/direction is greatly appreciated.
|
|
|
|
|
Hi,
I'm trying to encrypt data in a large text control on a C# windows form. Can anyone tell me how to encrypt and decrypt the data that's in just the text control? I've seen instances on how to encrypt and decrypt files, but not strings of data. I don't need any particular algorithm, but lets just say DESCryptoServiceProvider as an example.
Thanks
|
|
|
|
|
A file is just a stream, or an array of bytes. While the examples might use a FileStream , you could use a MemoryStream or even a StringReader , all from the System.IO namespace. Instead of relying on the examples, though, make sure you read the documentation to understand what's required. After all, a string is just an array of bytes, it's only handled differently. To get a string of bytes in a particular encoding, see the documentation for System.Text.Encoding in the .NET Framework SDK as well.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi
I want to create a small simple app that will help our users with there day to day jobs. In delphi this exe app would be around say 200k to download and install. Now if I create this in C# does anyone know how large this app could be. I've heard that you need to install the .NET framwork to run these apps and this is 20MB!! Is this correct or do you just need a cut down version? Or does XP / 2000 SPx include this framework?
Any info would be helpful - thanks
|
|
|
|
|
Man, how many times does this need to be addressed?!
Any language that targets the Common Language Runtime requires the .NET Framework to be installed, yes. Java requires a JRE, VB requires a VB virtual machine, and event C/C++ requires a runtime.
This was just asked and answer earlier today and I suggest you read the comments there. One person posted a link to a site that has a pre-linker but to use this is extremely BAD! See my comments below that.
In the future, please also click "Search Comments" above because chances are that someone's asked something already.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
The executable size will be about the same. Yes, end users need the .NET framework redistributable, 21MB. Many people running XP will already have it as it's included in Windows Update, and Microsoft will be including it in most of their future operating systems, including Longhorn.
The graveyards are filled with indispensible men.
|
|
|
|
|
Thanks Judah for that, do you know if Win 2003 server includes this framework and is installed by default?
Would I be correct in saying that if you get a web browser application with all the code held on the server then you only need the framework install on the server or would your clients also need this?
|
|
|
|
|
Windows Server 2003 comes with .NET 1.1 installed. For most smaller applications, the Framework is forward compatible (larger applications have a higher chance of using obsolete functionality). So, if you built an application for .NET 1.0, there's a chance that it'll run on .NET 1.1.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to draw a X axis,the X and Y data are such as following:
20000101,5.9
20000102,7.5
...........
...........
...........
20031201,5.8
The first row is year-month-day format,the second is the Y data.
Now my problem is how to draw the X axis using the first row.
it will be nice to you to give me a answer,or to give me a smilar sample.
Thanks!
|
|
|
|
|
There's plenty of examples of how to do this on CodeProject; you need only search[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is it possible to run a .NET executable without installing the .net framework ?
For example to link the framework and the application into one executable ?
|
|
|
|
|
No, to the dismay of most .NET programmers everywhere.
--
Joel Lucsy
|
|
|
|
|
joel[^] was on about this the other day, what you need is a linker of which apparently only one exists :
http://www.remotesoft.com/linker/[^]
I dont know how good it is or not but if I where you I'd get used to the fact that if you're doing .net your gonna need the user to have the runtime installed.
The smaller the mind the greater the conceit.
Aesop
|
|
|
|
|
Whether it's possible or not, this should not be used! It's a .NET application and requires the .NET Framework, just like Java requires the JRE, VB (pre-.NET) requires the VB virtual machine, C/C++ requres a C runtime library, Perl requires the perl runtime, etc.
Yes, this program may allow you to pre-link the necessary assemblies but you loose practically all the benefits of the framework, such as assembly redirection, certain levels of code access security (since it could only be verified at link time) which also means malicious code targeting the CLR can now wreak havoc on your machine, and much more.
It's not like you have to install the Framework every time you install a program. More and more machines are getting it as people with half a brain use Windows Update, and if you distribute on a CD then size should've be a problem. If you have the means, you can also use an installer that downloads the .NET Framework from a server if it isn't installed yet and there are many such examples here on CodeProject, such as Enhanced .NET Bootstrap Setup[^].
If you don't want to worry about all the advantages the Framework provides, then don't use it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
you need the .NET runtime installed. You can write an installation program with VS.NET, and have it check for the runtime, and if not present it will be installed.
So in general, your installation .exe will have the .net runtime embedded, but it must be installed.
R.Bischoff
.NET, Kommst du mit?
|
|
|
|
|