|
StreamWriter sw = new StreamWriter(@"c:\filename.txt",false);
sw.WriteLine((char)15); /// set char size while printing
sw.WriteLine("My name is: Jey");
sw.Close();
If u execute this code the text "My name is: Jey" inside the txt file. in "C Drive" and the file name "filename.txt"
Jey
|
|
|
|
|
In VS2005, whenever I write "using System.Windows.Forms.VisualStyles;" I get an error saying that 'VisualStyles' is not part of the 'System.Windows.Forms' namespace. Any ideas? Thanks.
|
|
|
|
|
|
I'm using VS2005 so I can only assume that 2.0 is enabled. I was wondering if this could be the issue. I know in the Eclipse you can pick which JRE you want to compile in. Is this an option somewhere in VS2005? Thanks again.
|
|
|
|
|
|
Yeah, "using System.Windows.Forms;" is right there at the top. This is confusing. Nobody seems to know what is going on. I tried a reinstall of the .net 2.0 framework as well as VS2005 itself. Thanks for your help so far, by the way.
|
|
|
|
|
In fact, nothing from 2.0 seems to be working! AutoScaleDimensions wont happen for me either. Well, I'm stuck.
|
|
|
|
|
Adding a reference to your project is not the same as writing a "using System.Windows.Forms;" statement at the top of your code file.
In your project, in Solution Explorer window, expand the "References" node. Is System.Windows.Forms listed there? If not, you'll need to add that reference.
Once you've done that, you should be able to type System.Windows.Forms.TextRenderer, which is a .NET 2.0 API. Do you see that class? If not, you're not using .NET 2.0. Make sure you're running Visual Studio 2005 and not 2003.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Goof around music jam with my brothers (with video)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Oh, sorry. We got our wires crossed. Yes, it is included as a reference. I can't add TextRenderer. The only options I get under .Forms are ComponentModel, Design, and PropertyGridInternal. And yeah, I'm using VS2005. I don't own 2003.
Plus, I seem to be getting an error with "Application.EnableVisualStyles();". I thought this was only an issue in 1.1. Uh-ho.
|
|
|
|
|
Ok, I removed all references from my project and added them again and it no longer tells me that VisualStyles isn't an option. But, thats about it. All the other errors are still there (including the lack of TextRenderer, and the Application.EnableVisualStyles() error). This is just getting nuts.
|
|
|
|
|
When you added this reference, did you add the reference yourself? Because if you've got .NET 1.1 and 2.0 installed side by side, then you'll have System.Windows.Forms.dll installed. You'll need to make sure you're running the 2.0 version.
Can you use generics or anything in the System.Collections.Generic namespace?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Goof around music jam with my brothers (with video)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Well yeah, I removed and then added all the references. Seems there is no problem with including System.Collections.Generic. Should I uninstall 1.1 and reinstall? Maybe it has some sort of death-grip on my machine. Can VS survive without it?
|
|
|
|
|
VS2005 will run on .NET 2 alone, no need for .NET 1.1. You could try it; but my guess is its overkill; there's something simple we're missing here.
If you click on the System.Windows.Forms.dll reference, in the properties pane, do you see it as version v2.0.50727?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Goof around music jam with my brothers (with video)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Yup, it tells me it is version 2.0.0.0, runtime 2.0.50727. Now it is telling me that in a couple of my projects there are 'conflicts between different versions of the same dependent assembly.' Maybe this means I just have to add and remove all the refs from my projects. It doesn't seem to be upset about VisualStyles once I've done that. Maybe this is problem solved. Also, it no longer is throwing errors in the IDE on new projects I create. Huzzah! I think we've done it. Thanks for all the help with this. I still have no idea why this all happened, but I guess it's taken care of.
|
|
|
|
|
|
Hello,
I tried a small example from msdn of encrypt/decrypt elements in XML file.
When I executes the Decrypt there is an exception "Unable to retrieve the decryption key." even so I use the same key name.
Platform: .Net 2005, c#.
The algorithm is AES, Asymmetric.
The example from the msdn.
Than you.
|
|
|
|
|
|
Hi there!
Please help! I have a main menu form with two buttons that go to the same form. On the same form that these buttons go to; I would like to load it in a different way, basically if the form was clicked by the ADD button then just initialize the components else if it was clicked by the MODIFY button then parse the text file and load all data into the text boxes. I know how to parse the file, I just want to know how to ask the form to do this.
Here is some code that I have written so far on this, maybe it will give you guys some idea.
public AddDC()
{
//
// Required for Windows Form Designer support
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~NEW CODE START~~~~~~~~~~~~~~~~~~~~~~~~~~
CB Check=new CB(); //CB is the main form
if (Check.cmdAdd_Click())//////THIS IS WHERE I AM HAVING A PROBLEM, HOW DO I WRITE THIS IF STATEMENT
{
InitializeComponent();
}
else
{
TextReader rd = new StreamReader("C://CB//config.ini",Encoding.Default );
string line;
line=rd.ReadToEnd();
rd.Close();
//while (line = rd.Read())
//{
string Field1 = line.Substring(189, 13).Trim();
//string Field2 = line.Substring(5, 4).Trim();
//string Field3 = line.Substring(index, length).Trim(); // (trim to remove whitespaces)
MessageBox.Show(this, Field1);
InitializeComponent();
}
sasa
|
|
|
|
|
I think of another way.
On the main form, with the two buttons -> for each make a different click event, you load the next form by a different way.
In the next form, make to constructors -> one that doesn't get any values (and initialize components), and another one to parse stuff like modify etc. that could inherit the first constructor.
Then in the first form just load it with the wanted constructor.
|
|
|
|
|
Hi NaNg15241,
Thank you for your response. I do have 2 different click events on the main form. Basically, what I need is when the Add form opens, I want to check which button was clicked to get to the form, i.e. Add button or modify button. If add then initialize and if modify then parse the file and then initialize,
sasa
|
|
|
|
|
If you can't read, I gave a specific answer to that.
Your error: you are trying to check which button was clicked on a new form that was just created -> no buttons were clicked!!!
I have another way, make a new public enum with the name Clicker and have to values in it -> Add, Modify.
On the next form, make the constructor get that enum (eg. public Form2(Clicker WhoClicked)).
And in the main form in the Add click event do: new Form2(Clicker.Add).
Also in the modify click event (Clicker.Modify).
And then in the Form2 constructor you can define what to do based on the Clicker that was sent.
I gave you in this whole thread two ways to do it.
If you can't read or know what I wrote then you probably learn some more C#.
NaNg.
|
|
|
|
|
NaNg;
You don't have to be rude, it is a message board where people ask for help and that doesn't mean that you come out degrading people. Thank you for your help.
sasa
|
|
|
|
|
Hi, i have a control library that compiles to a (.NET) .dll. When i add the reference of the dll to my exe proj i am unable to view the clasess in the object browser. Here is an Image[^] of the problem.
Thanks for your help!
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
|
The methods i have in my dll are public by using:
public void writeToFile()
how can i check to see if i have classes public?
Don't be overcome by evil, but overcome evil with good
|
|
|
|