|
Hi. I'm a C# beginner and I am writing text to a file, but the reciever of the file wants it to be encoded in ISO/IEC 8859-1. I was earlier using System.IO.Streamwriter but I dont know how to do this with that class. Does anybody know hoe to do this in C#.Net
Robert
|
|
|
|
|
System.Text.Encoding.GetEncoding("iso-8859-1");
Check out the documentation for the Encoding class in the VS 2005 help.
|
|
|
|
|
I haven't done it myself yet, but you might try this:
StreamWriter text = new StreamWriter("test.txt", false, Encoding.GetEncoding("iso-8859-1"));
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yes, thanks. It's working now!
|
|
|
|
|
I have a windows application that I like to look a little more interesting. How would I go about applying a skin to it?
Thanks
Wacky waving inflateable arm flailing tube man!
- Family Guy
|
|
|
|
|
i want to load values from database(MS Access) into combo box..thank you.
|
|
|
|
|
Not much to it.
1) Make a connection to the database
2) Query from the table holding the values you want in combobox
3) Iterate through the query results and add into combobox.
Plenty of code examples on this site to help.
PJC
|
|
|
|
|
hi!
just an option in the step 3 of your suggestion, you can also use the DataSource property of the combobox and pass a datatable or a dataview.
microsoc
|
|
|
|
|
microsoc,
Thanks for that suggestion. Totally forgot about DataSource being another way of populating the combobox :->
Paul
|
|
|
|
|
Then do it!
modified 12-Sep-18 21:01pm.
|
|
|
|
|
How do I get a list of all of the tables in a MySql database?
Wacky waving inflateable arm flailing tube man!
- Family Guy
|
|
|
|
|
Have you read this?
Personally, I'm not a fan of ODBC and prefer ADO.NET.
I'm sure a search of Google would turn up other options.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
Hi,
Is there any way in SharpDevelop to not have XP visual styles enabled?
Regardless of wether or not i use Application.EnableVisualStyles(), the textboxes and comboboxes in the program i am working on still have the xp look.
Thanks
|
|
|
|
|
Pumk1nh3ad wrote: SharpDevelop
Which version are you using?
Paul
|
|
|
|
|
|
Pumk1nh3ad wrote: I am using version 1.1
Weird because I cannot get XP styles with 1.1, have you looked on SharpDevelop's forums?
Paul
|
|
|
|
|
Thanks. I will look on SharpDevelop forums.
|
|
|
|
|
Hope you find an answer there, those guys are pretty on top of things on that site. I just haven't used SharpDevelop much since working with VS2005, but nontheless, I still use it from time to time
PC
|
|
|
|
|
Maybe (just maybe) there's an App.manifest file that gives your app XP visual styles. Just an idea...
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Thank you!
There was an .manifest, and when i deleted it, the controls went back to the normal styles.
|
|
|
|
|
I'm glad I could help!!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Often I have functions, typically math, formatting, or database, where I'd like to use them in many different places in my application. What is good-form for instantiating and providing scope across many classes?
As a (semi)concrete example:
public class ContainerClass {
public T MuchUsedFunction( args ) {
// foo
}
}
public class A {
private ContainerClass cc = new ContainerClass();
public A_method() {
T result = cc.MuchUsedFunction( my_args );
}
}
public class B {
private ContainerClass cc = new ContainerClass();
public B_method() {
T result = cc.MuchUsedFunction( my_args );
}
}
So here classes A and B both instantiate a ContainerClass. I'd rather not do this.
Also, I'm not too keen on passing a handle to ContainerClass to A and B because, in a scaled-up version, I would eventually be passing many such handles. Finally, I appreciate that I may not want 'global' scope for ContainerClass and would like to know how I can control its scope.
What's the best way to handle this?
Thanks.
|
|
|
|
|
You basicly have two options.
One is to make a singelton class (do a search on CP for tutorials) or use static methods.
In the later case you can call a method like this: ClassName.MethodName()
Of course the second has it's limitations, as you can't use non-static methods of that class...
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
A singleton makes 1 instance of the class -- but how do I provide scope to its methods to other classes? I don't see how a singleton solves the pb.
|
|
|
|
|
class Base
{
protected ContainerClass cc = new ContainerClass();
}
class A : Base {}
class B : Base {}
|
|
|
|