• 15
• 15
• 11
• 9
• 10

# [.net] another c# problem (RANT)

This topic is 4026 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm really pissed off! When I first saw C# I thought "they took java and removed the annoying things and added the nice thins: it's a beatiful language". Now I still think that the language is very good, but the library and the documentation are really bad! Let me explain: -First I tried to modify by hand the field Rtf of a RichTextBox. The documentation says I can do this, but it didn't worked. I've spent 3 days to discover that RTB automatically removes those tags that are not used by the text. -Then I tried to get the current font from the RTB. I first read the name and then the size (two properties of the font class). Nothing, the code didn't work properly until I discovered that I had (don't know why) to first get the whole font object in a local reference, and the on that reference ask for the two values. Why? Nowhere they say you need to do this way. -Now I'm creating an OpenFileDialog class. I set a few filters but when the user switches from one filter to another the dialog shows nothing: just as no files with that extension exist. This is the code:
                OpenFileDialog open = new OpenFileDialog();
open.Filter = "Rich Text Format (*.rtf)|*.rtf|Text files (*.txt)|*.txt|All files (*.*)|*.*";
open.FilterIndex = 1;
open.DefaultExt = ".rtf";
if (open.ShowDialog() == DialogResult.OK)
{
CreateDocument(open.FileName);
}


First it shows the rtf files. Then if I swich to all files or txt nothing appears (as if the window doesn't update the content). Nothing is displayed even if i go back on rtf files. Help me please while I keep looking for a solution! Sorry for the lenght of the post.

##### Share on other sites
I tried that exact code you posted with the createdocument commented out and it works fine here under .net 2.0, shows my rtf's by default after changing the directory to a place that had an rtf, and when I selected the all files, it showed me the rtf and many .bin/.xls/.bmp I had in the same directory.

##### Share on other sites
Thank you, I was quite sure it wasn't a problem of code because I've found a guy (on a forum) that once had the same problem: he was writing two apps, and using the very same code he was having that problem on one of the app but not on the other one. I will try by reinstalling the .Net enviroment...

##### Share on other sites
Just a little comment here. It is not C# you are having trouble with, it is .net.

theTroll

##### Share on other sites
Quote:
 Original post by TheTrollJust a little comment here. It is not C# you are having trouble with, it is .net. theTroll

Yep, in fact I've said that I like the language, but the libray is giving me a lot of trouble lately... anyway I wrote c# in the title just to make it clear which language I was used (in case it matters).

I tried removing and reinstalling everything, but nothing worked for me. I wrote the smallest app I could think of to show the problem:
using System;using System.Windows.Forms;class Mainclass{	public static void Main()	{       OpenFileDialog open = new OpenFileDialog();                open.Filter = "Rich Text Format (*.rtf)|*.rtf|Text files (*.txt)|*.txt|All files (*.*)|*.*";                open.FilterIndex = 1;                open.DefaultExt = ".rtf";                if (open.ShowDialog() == DialogResult.OK)                {					Console.WriteLine("Apri");                }	}}

This code show this strange behaviour on my machine.
Some suggestion?
Thank you!

##### Share on other sites
Code works just fine on my machine as well. I'd say it's not .NET, it's your machine. I'm assuming you're running .NET 2.0 on XP SP2? If not what's the specs on your machine?

##### Share on other sites
Quote:
 Original post by MachairaCode works just fine on my machine as well. I'd say it's not .NET, it's your machine. I'm assuming you're running .NET 2.0 on XP SP2? If not what's the specs on your machine?

XP Professional SP2. I've installed .NET 2.0 and also the dotnetfx3.exe file. Same behaviour both from the Visual Studio and from command line using directly the csc command. Debug and Release seem to behave the same way. I have 1gb of ram, athlon xp 2600Mhz.
I really hope to find a solution...
Many thanks to you all.

##### Share on other sites
Like:

public static void Main()
{

The VS2005 debugger shows this immediately...

Btw, DefaultExt does not need the dot.
For example:
open.DefaultExt = "rtf";

And the default for FilterIndex is 1.

Lenin said: "Study! Study! Study!"

##### Share on other sites
Quote:
 Original post by TheTrollJust a little comment here. It is not C# you are having trouble with, it is .net. theTroll

It's not .NET that is the problem, it's lack of reading comprehension.

This isn't the appropriate forum for rants. Try the lounge next time.

##### Share on other sites
Quote:
Original post by capn_midnight
Quote:
 Original post by TheTrollJust a little comment here. It is not C# you are having trouble with, it is .net. theTroll

It's not .NET that is the problem, it's lack of reading comprehension.

This isn't the appropriate forum for rants. Try the lounge next time.

I was quiet aware of that midnight, I was trying to be polite.
theTroll