|
Yea, I think I have a problem. The way I want to do it doesn't seem to want to work. I see that there is a method of the file class that will read all the lines to a string array. If I use that, then I will know the length, but then I'm reading the information twice, which will be slower.
I will still look for other ways. Thanks for the hints.
Tim
|
|
|
|
|
Could you explain more of what you are trying to do. There are other options for collections besides arrays,maybe a combination of them would work.
|
|
|
|
|
What I have is a csv file that has the names of my drawings, and the revision level they are at in the repository. I want to take that file and fill in a dialog box with the information for it, and the drawing. I can get the current level from the drawing, I have code for that already. Then if the revision level of the drawing needs to be updated (long story, happens alot) then I can pick it in the dialog box, type what the new revision should be, and have it update the drawing.
I'm thinking of having it as a list view, with details shown in the dialog, so all the items will be on one line, and have the options of headers.
Where I'm stuck at is, trying to create an way to have a list/array nested in another list/array that will fill out my dialog box. I don't know how long the main lis/array will be, but the sub list/array will only be three items.
Hope that explains it a little more clearer. Thanks for helping.
Tim
|
|
|
|
|
You could declare a simple class or struct that encapsulates the three values and afterwards use a generic List of this class or struct. The folowing examples uses no useful names and of course the instance fields should be made accessible by using properties.
class Values
{
public string one;
public string two;
public string three;
public Values(string one, string two, string three)
{
this.one = one;
this.two = two;
this.three = three;
}
}
List<Values> list = new List<Values>();
By the way, the encapsulation of the values furthermore allows them by name which increases readability of the code.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thank you Stefan. I'm not sure how to use this yet, but it looks like it might work. Let me experiment with it, and if I can't figure it out, I will post back.
Tim
|
|
|
|
|
Learning by doing; I like that attitude I have one more small example though, because I saw that something was lost in my first posting (the generic part of the list declaration). I've also included two more lines that simply add a value and afterwards access it. Have fun with experimenting
List<Values> list = new List<Values>();
list.Add(new Values("a", "b", "c"));
string three = list[0].three;
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks again Stefan. I think I can make this work.
I hate the idea of just asking for people to do things for me. I only ask when I can't find how to do something, either with the help files, or a search on the net.
I have not used lists in C# yet, in (Auto)Lisp I use them all the time, and love them. I hope they are kind of the same way in C#.
Tim
|
|
|
|
|
T.Willey wrote: I hate the idea of just asking for people to do things for me.
Unfortunately not everybody thinks this way.
T.Willey wrote: I have not used lists in C# yet, in (Auto)Lisp I use them all the time, and love them. I hope they are kind of the same way in C#.
I don't know (Auto)Lisp, so I can not promise anything, but personally I like list and all the other generic stuff they introduced in .NET 2.0. Gives alot new possibilities and makes programming much easier sometimes.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
It appears once again I have gone the wrong way. I get caught up in arrays when I try to use C# in place where I don't have to. Instead of putting the items into an array, and then into the dialog box, I just put them into the dialog box when I get them.
I thank the people who responded and helped me, I hope you don't think I wasted your time, as I did learn some new things that I think will be helpful in the future.
One thing I did look into was the list class, but since the program I'm programming for only use .Net1.1, that doesn't work for this issue at this time.
Once again Thanks.
Tim
|
|
|
|
|
Hi,
How can I interact with send/receive button in Outlook 2003?I want to filter incoming emails, change their format in txt and save them on desktop. All using C# obviously.
Help me please.
|
|
|
|
|
There's a toolkit for programming for Office using .NET, I'd say that's where you need to start.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thanks for reply.
Where could I find this toolkit?
|
|
|
|
|
|
I guess there's no equivalent, boohoo! Why M$, whyyyyyyyy!
Sorry, getting slightly depressed from it.
Wout
(PS: And no, the AppDomain.AssemblyLoad thing is not what I want).
|
|
|
|
|
wout de zeeuw wrote: Why M$, whyyyyyyyy!
Because the .NET CLR doesn't support the necessary exports to support making a library .DLL lie you want. There are alternatives to the single method you want to use. It just depends on what you're doing.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I'm about to release a new component and I need to do some license checking on a coarse level. My initial idea was to just bomb out after the trial period in a sort of DllMain method.
Most of the code consists of structs for which performance is critical. That means I can't do any license checking or even static initializers in those. So if I can't do the license check in a DllMain, people can use it without restriction basically.
Wout
|
|
|
|
|
What's the main component which people will use, a class, a component a control etc?
I have no idea what I just said. But my intentions were sincere.
|
|
|
|
|
That's the tricky part, most of it is just vector, point and matrix structs (and in all honesty, that stuff isn't all that special, so I shouldn't worry too much about license checking that part).
And then there are a few classes for the somewhat bigger geometric stuff like polyline, polygon and triangulation classes, so I should probably settle for making some static initializers in those that do license checking.
I hope microsoft will give us component developers some better tools for protecting our software. They could have quite easily done something in the assembly and type loading department so developers could hook into it.
Wout
|
|
|
|
|
Aye things could be made a bit easier.
I have no idea what I just said. But my intentions were sincere.
|
|
|
|
|
Hi
How can I compare two points in c#? For example,
Point p1 = new Point(0, 0);
Point p2 = new Point(20, 20);
How do I p1 < p2 or p2 < p1? I know p1.equals(p2) to check whether both are equal. But how do I do <, >?
Thanks in advance
Muthu.
|
|
|
|
|
How do YOU define if a two-dimentional coordinate is less that (or greater than) another two-dimentional coordinate?
|
|
|
|
|
Basically, I have a panel in my form, and I want to capture whether my mouse is out of panel or inside panel. I dont want to use mouse_leave and mouse_enter.
so, when I capture panel's top-left and bottom-right I need to compare it with mouse pointer's coordination.
hope i explained clearly.
Thanks
Muthu.
|
|
|
|
|
What's wrong with comparing the x and y coordinates of the points?
Wout
|
|
|
|
|
The only thing you can really do is defining which is below or upper and left or right to the other. Is that what you want?
The notion of comparing 2 points defined by 2 dimensions coordinates is inappropriate in the context.
David Domingues at webrickco@gmail.com. Feel free to visit http://webrick.athost.net/index.php
|
|
|
|
|
is a point inside some rectangle ?
such a popular question must have a very simple answer:
bool Control.Bounds.Contains(Point)
Luc Pattyn
|
|
|
|