|
I was wondering if there is way for me to set current input language using C# (not Windows settings)... for instance whenever user focues my form I want to set current language to, let's say Spanish.
Anyone can help?
And... yes; I presume that languages are installed but it would be good if in response would be included a hint to where can I see how to detect currently installed languages on computer and do little validation.
Tnx
|
|
|
|
|
Here is some sample (vb, sorry) code that switches to a new language, and then back again when done. The new language is stored in the string variable currentLanguage
Dim oldCulture As System.Globalization.CultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture
Try
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo(currentLanguage)
...do stuff...
Finally
System.Threading.Thread.CurrentThread.CurrentCulture = oldCulture
End Try
my blog
|
|
|
|
|
Hey,
I've built a small email application(I use the System.Web.Mail namespace), when I send the email/emails with attachments they work very well, my network technician says its works pretty well, expect that there is no disconnect, my program simple just shuts down. I was wondering if there isnt any way to tell the server that we are quiting and done sending. It seems I dont send any quit command so that the smtp server releases my connection.
Some of the code:
SmtpMail.SmtpServer = "myMailserver.com";<br />
<br />
MailMessage mail = new MailMessage();<br />
mail.To = this.smtpTo.Text;<br />
mail.Cc = this.stmpCC.Text;<br />
mail.Bcc = this.stmpBCC.Text;<br />
mail.From = this.smtpFrom.Text;<br />
mail.Subject = this.stmpSubject.Text;<br />
mail.Body = this.MessageBox.Text;<br />
MailAttachment attachment = new MailAttachment(AttachmentBox.Text);<br />
mail.Attachments.Add(attachment);<br />
SmtpMail.Send(mail);
Best Regards
/Johan
|
|
|
|
|
SMTP functionality is provided by CDO on Windows (installed with the Virtual SMTP Server, Microsoft Exchange, and - IIRC - Outlook) and works however the CDO client libraries work.
Roll your SMTP client. It's really quite easy. See RFC 821 at http://www.ietf.org/rfc/rfc0821.txt[^]. There should also be some examples here on CodeProject, as well as threads in this forum (click "Search comments" above to search this forum) - I know I've discussed this before.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am compiling a .CHM file with Help & Manual 3.0. I have several fields labeled as popup type. These are outputed into an internal text file titled CSHelp.txt. I need to know how to access this text to display as a popup when F1 is pressed on a control. I see that you can access the internal html of the chm file by using html\yourfile.htm in HelpKeyword field. I assume there is an internal type string that I can use to access the popups. I am using the HelpProvider interface in the designer. Thanks in advance.
|
|
|
|
|
You can access the txt file in the same way: mychm.chm::/CSHelp.txt. How this text is parsed into your application depends on how it's stored. Any file compiled into the CHM is accessible via a URL.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello everybody!
First I´m sorry about my english, I come from germany.
I have a little obscure problem with reflection.
I created a own class with only one constructor ->
private static System.Reflection.Assembly assembly;
public MyReflection(string dllfilename)
{
assembly = System.Reflection.Assembly.LoadFrom(dllfilename); //**
// do something with assembly (this part works fine!)
}
In my main application I´m creating an object from this class like:
MyReflection myRefl = new MyReflection(dllfilename);
I choosed that a user can change the assembly file (for example to actualize it) in my main application and the code line "MyReflection ... = new ..." is recalled with the different dllfilename.
If I debug MyReflection class it is working fine until the line signed with //**.
I can recrate the object how many times I want, but it keeps the first assembly file. Why?
Why doesn´t actualize my computer this file (the string "dllfilename" is always appearing correctly!)
Is it a problem with the garbage collector? And if this is true, how can I definetely force that C# destroys an object?
It would be nice if someone is answering to me..
Ciao
Norman-Timo
|
|
|
|
|
Are you trying to load a different version of the same assembly? If so, if you havn't strong named the assmebly the CLR class loader will disregard the version number of the assembly. To perform this operation safely so you don't have to deal with file locking, take a look at AppDomain.ShadowCopyFiles as this is implemented by fusion and also used in ASP.NET. At least load the assembly into it's own AppDomain which will allow you to safely unload the AppDomain when you are done with the assembly.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hello,
I am new to .Net and wanted to know if dot Net has a somethig similar to or API for creating and managing Compound documents. Actually i want to port an application that makes extensive use of Compound Files to .Net. So is there any equivalent of Compound Files in .Net ???
Omar Alvi
|
|
|
|
|
As in compound documents that implement COM interfaces? No. You have to declare the necessary COM interfaces with the proper GUIDs (using the GuidAttribute ) and declare them as IUnknown , IDispatch , or dual interfaces using the InterfaceTypeAttribute . Make sure the methods and properties are in the same VTBL order for IUnknown and dual interfaces, and that you use the DispIdAttribute to declare the proper DISPID for IDispatch and dual interfaces.
A couple are already defined in System.Runtime.InteropServices , such as UCOMIPersistFile , but other interfaces like IPersistStream are not.
If you mean "compound documents" are self-serializing documents, then you can use runtime serialization. See Serializing Objects[^] in the .NET Framework SDK for more information and examples. These types of files are not like COM compound documents, however.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I would like to have dynamic help feature in my application as we can see in .net framework.
I would appreciate any links & help.
Ravindra
|
|
|
|
|
You should start by reading the documentation for the help classes provided in the .NET BCL (base class library):For information on how to create HTML Help files (CHMs), I recommend you do a search on "HTML Help" using google or something. There's a lot of information about HTML Help on the web.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
Thanks for your reply. I have an application which has framework as we can see in .net framework,if u r aware of it.We have dynamic help feature in .net ie.,This window provides links to topics that are specific to the current area you are using or task you are trying to complete within the IDE.
I have images as controls in my application I would like to have the same hynamic help feature in my application.
|
|
|
|
|
I'm sorry, but I'm really having problems trying to understand what you're asking.
If you are writing code for use in VS.NET and want to display dynamic help like VS.NET currently does, I suggest you download and read the Visual Studio .NET Help Integration Kit (VSHIK)[^].
If you want to have functionality like dynamic help in your application, you should read the link I posted before about HTML Help. With that and many sources available throughout the web, you should be able to develop something. The classes I mentioned will be of very little help, though. You'll need to host the WebBrowser control (and there's many articles about how to do that on this site, but the easiest way is to customize your toolbox in VS.NET, click on the COM tab, and select the Microsoft Web Browser from the list). You could simply pass it URLs like mk:@MSITStore:C:\Program Files\My Company\My Application\Help.chm::/index.htm (as an example), since Internet Explorer (rather, the URL moniker) recognizes the mk: protocol. How you associate UI elements and what not with URLs is up to you, but reading ablyt HTML Help will help you understand how to do this the "right way", which is when you use the information already in the CHM to associate elements with help topics.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for your valuable information Mr. Heath.
I have developed a help application using htmlworkshop tool & using helpprovider as an interface I have integrated this into my application.
Using help class I developed one more form,dynamic form, where we can provide interface to the help application using help navigator & some of the methods in it.
But now to make it dynamic ie, when the focus is on some particular control,the information regarding that particular control need to be displayed in the dynamic help form.Ie, information need to be changed dynamically in the form depending on the focus of the control.
The info. in dynamic form should have link & through link we should be able to get the details regarding it through help application.
What is the best way to do it.
Waiting for your reply,
Ravindra
|
|
|
|
|
One way would be to store the context in the Tag property (like the help topic filename or some key) and hook-up the GotFocus event of each Control you want dynamic help displayed for to the same event handler. In that event handler, cast the first parameter (typically called sender , but the param name doesn't matter) to a Control , then use it's Tag property to display the help file you want.
There's many other ways, but this way would probably be easiest.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to display text in a certain font, but I don't know how..
how can I do it?
and another thing - if I want to include a font that isn't on the user's machine, how is it done?
thanks ![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
If you type "Font" into your Managed DirectX 9.0 help (which you should've installed), you'll have all the information you should need if you read the rest of the documentation. Alternatively, pick up a book on Managed DirectX 9.0 like Managed DirectX 9 Kick Start: Graphics and Game Programming[^].
This allows you to use the System.Drawing.Font class provided in the .NET BCL. You can keep a collection of private fonts (those not installed on a system) by distributing the fonts with your application (or embed them as manifest resources and extract them before proceeding) and use the PrivateFontCollection class to add them to the font collection (along with installed fonts, which is encapsulated in the InstalledFontCollection ).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Recently i come accross forums, or websites, claiming people are losing there job related to C# experiences, and saying that C# wont exist for much longer? one post is located at http://www.mail-archive.com/c_sharp@p2p.wrox.com/msg02322.html[^]
I HOPE this is CERTINALY NOT TRUE, i just started learning C#, and i obsolutely LOVE its language, its much better than C++, and more reliable
|
|
|
|
|
C# is at the core of Microsoft's .NET strategy. I don't see it failing.
What you are reading is a Sun zealots FUD. Just look at his sig.
Michael
CP Blog [^]
|
|
|
|
|
Michael is right. Just some Sun zealot trying to spread FEAR (False Evidence Appearing Real)
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Gary Busey! Do you know the FRIENDS one? I loved that show...
/\ |_ E X E GG
|
|
|
|
|
What are you talking about?
Who is "Gary Busey"?
The FRIENDS one what?
I'm so confused...
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Hi everyone,
I was wondering if it is possible to disable addition of new rows when using the DataGrid control? The only possible way I found is to set the AllowNew property of the DataView to false, but this only works when the DataGrid is data bound to this instance of DataView.
My problem is that I'm using the same instance of DataGrid with several table styles to edit several tables of a DataSet, and the user is allowed to navigate among them using the relations of this DataSet. But this way, I'm unable to achieve this.
I have tried setting the DefaultView.AllowNew=false for the table that shouldn't allow new rows, but the DataGrid will probably use another instance of the DataView, so this doesn't work.
I guess that the only solution would be to use the Navigate event of the DataView and get the instance of the DataView that DataGrid is using, but I just don't know if this is the way, and how to get that damn DataView instance.
Thanks for any clues in advance!
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|
|
I have it! I've been trying to make it work since Friday, and finally found what I've been doing wrong. This code in the Navigate event handler will do the trick:
private void dataGridModules_Navigate(object sender, System.Windows.Forms.NavigateEventArgs ne)
{
if(this.dataGridModules.DataMember.IndexOf("name-of-the-table")!=-1)
{
CurrencyManager cm=(CurrencyManager)
this.dataGridModules.BindingContext
[this.dataGridModules.DataSource,
this.dataGridModules.DataMember];
((DataView)cm.List).AllowNew=false;
}
}
My problem was that I was using only the name of the table for the BindingContext indexer, when I replaced it with this.dataGridModules.DataMember it started to work .
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|