|
And your question is what?
I'm going to assume it is how you read a field in a dataset.
First, get the proper DataTable out of the Tables property of the DataSet; then find the appropriate Row in the Rows property of the DataTable, finally read the appropriate column out of that.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
If you don't have Visual C# (ie you purchased VB.NET standard) then you're out of luck with this tool since it was created with C#. It is also a tool created for use with VS.NET, so you are also out of luck if you aren't using VS.NET.
When I did a reinstall of CollectionGen a few minutes ago I took a look at the readme file and found that it was missing a few steps.
First off download it from the link above, then unzip it to the directory of your choice (this will be the final resting place for it so place it where you want it).
Now open the CollectionGen solution file (CollectionGen.sln) you will probably get some errors about not being able to find the Visual Source Safe server; just tell it ok to get through the warnings.
Now if you don't don't have VB.NET, remove the vbtestcli project from the solution [right click on it and choose remove, tell it to overwrite the solution file if it complains about being read-only].
This is where the readme is missing some steps.
Right click on the CollectionGen project, and choose "Add Reference..." click the Browse button and browse to the Microsoft Visual Studio .NET\Common7\IDE directory select the "Microsoft.VSDesigner.dll" file. 'Ok' back to the main IDE. Now right click on the testcli project and choose "Add Reference...", click Browse, and browse back to that directory again. Select the "Microsoft.VSDesigner.dll" file, then click Browse again; this time selecing the "microsoft.visualstudio.designer.interfaces.dll" file. Again, click OK back to the main IDE.
Now that that is done, change the combobox at the top of the IDE to say Release instead of Debug and build the solution.
Using the Command Prompt provided by VS.NET (look in VS.NET's Tools program group in the start menu) run the setup.bat file located in the CollectionGen\redist.
That should be all you have to do
To test it right click on one of the XML files in the testcli project and choose "Run Custom Tool". If all goes well you'll see VS.NET work for a bit then nothing will happen. That is good!
Now to use it in your own program simply create an XML file of the same format as listed in the readme file. Add that file to your project, then change the "Custom Tool" property to "SBCollectionGenerator".
Thats it
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
|
Nishant S wrote:
what is this collectiongen thingie
Strongly typed collection generator for VS.NET.
Essentially you have an XML file that specifies the types and what kind of collection to generate and it does so. If you want to support a new type of collection its as simple as creating a new XSLT file and adding it to the project and recompiling CollectionGen.
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
Does anyone know how to generate an enum of the video capture hardware, or how you would get other kind of information about hardware installed on a computer in C#?
Thanks,
Steven
|
|
|
|
|
How can I create a statusbar with 3 panels with 3 sliders (in every panel 1 slider)?
Just like this:
Text... |---[Slider]---| |---[Slider]---| |---[Slider]---|
|
|
|
|
|
You should probably just make your own control, and make it look like a statusbar. When you add it to your form, just dock it to the bottom.
|
|
|
|
|
I mean, who decided that I could not do this ?
const int n = x+5;
And why can't I create a static method and use it from a class instance OR overload a method so that both the static and non-static versions exist ?
Who wrote this rubbish ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Christian Graus wrote:
const int n = x+5;
I don't see any problem here.
Step back, rub your eyes, take a deep breath, stretch a bit, and reflect on the relative importance of CP, CG, the age / travel time sustained by supposedly 'fresh' cheese curds, and Life in General. - Shog9
|
|
|
|
|
Nor do I, but the compiler will only accept
const int n = 5;
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
I meant to say that I don't see any problems with compiler not accepting it. You need to get over C+ mentality. there ain't no const variables only const constants.
Step back, rub your eyes, take a deep breath, stretch a bit, and reflect on the relative importance of CP, CG, the age / travel time sustained by supposedly 'fresh' cheese curds, and Life in General. - Shog9
|
|
|
|
|
Rama Krishna wrote:
I meant to say that I don't see any problems with compiler not accepting it.
Thats cool. So why does my compiler not accept it ?
Rama Krishna wrote:
need to get over C+ mentality. there ain't no const variables only const constants.
That's really deep, but I have no idea what the hell it means. :P
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
A const in C# and the .NET framework is just that. A constant. When you create a constant in .NET it is not stored as a variable. Anywhere that it is used the value is copied directly into your code. So it makes sense that they will not allow you to use a variable in teh declaration of a constant.
Jared
jparsons@jparsons.org
www.prism.gatech.edu/~gte477n
|
|
|
|
|
I'm not interested in the under the hood semantics ( I was actually reading up on them in the Richter book this morning ), I just want to know how to pass a variable into a function and then from that variable define another that is const for the life of the function call. const is an incredibly important part of programming in C++ because it allows me to specify that I want to be able to trust that a value has not changed. Does C# provide another mechanism for this in regard to function parameters, etc. ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Christian Graus wrote:
That's really deep,
I was watching a movie when I wrote that.
Anyway,
const in C# is not same as const in C++.
These are valid bothe C# and C++
const int x = 200;
const int y = 200 + x;
But this is not
void func()
{
int x;
const int y = x + 10;
}
For the simple reason that compiler cannot calculate the value of y at compile time.
Step back, rub your eyes, take a deep breath, stretch a bit, and reflect on the relative importance of CP, CG, the age / travel time sustained by supposedly 'fresh' cheese curds, and Life in General. - Shog9
|
|
|
|
|
OK then, how do I do what I want ? If the answer is I cannot then C# just plain sucks as far as this is concerned. I should be able to define a value from a variable passed into a function and mark it so that no code further down can modify the value.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Rama Krishna wrote:
I meant to say that I don't see any problems with compiler not accepting it.
I'm sorry to inform you that my compiler still does not accept the assignment of a variable to a new, const value.
Rama Krishna wrote:
You need to get over C+ mentality. there ain't no const variables only const constants.
I still have no idea what this means. Could you please help me out here ? Are you saying I am doing it wrong, or just being cute about my use of the term 'const variable' ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
|
Nishant S wrote:
I thought you could in C#
Nope.
class Myclass
{
static public string Myfunction()
{
return "C# can be pretty dumb at times";
}
}
Myclass s;
System.MessageBox.Show(s.Myfunction()); // No way, no how.
This will NOT work. Nor can I do this:
class Myclass
{
static public string Myfunction()
{
return "C# can be pretty dumb at times";
}
public string Myfunction()
{
return "C# can be pretty dumb at times";
}
}
as it will (correctly IMO) not compile. So if I want to provide some methods as static because they do not need any internal state access, and could be more useful if they could be accessed that way, my users cannot access them from an instance of my class.
That SUCKS.
Christian
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
statics belong to the Type, not the Instance.
therefore, static methods use the Type instead of the Instance for their context.
Why do you see this as a problem?
|
|
|
|
|
Because it's counter intuitive. I've given Nish a more detailed response, if you're interested.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Christian Graus wrote:
System.MessageBox.Show(s.Myfunction()); // No way, no how.
That's wrong usage anyway. The static method is a class method and not an instance method
Instead of s.MyFunction you *must* use MyClass.Myfunction and I think that is the right way of doing it
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Nishant S wrote:
That's wrong usage anyway. The static method is a class method and not an instance method
DAmmit Nish, that is my whole POINT !!!!
Nishant S wrote:
Instead of s.MyFunction you *must* use MyClass.Myfunction and I think that is the right way of doing it
Why ? I'll settle for one good reason that an instance of a class cannot know about methods that exist once and once only for all instances of that class.
In C++, I can do exactly what I just said, and it makes sense. A class can have a private static member, for example. I answered a question on comp.lang.c++ this morning where someone had a class called Actor and wanted to keep a list of actors visible to instances of Actor internally. A private static list is the way to go. In C#, a static that is also private is invisible to EVERYONE. It is simply counterintuitive, if a method I am writing can be written as static, for my users to have to type in the name of the class instead of the name of a class instance. They should be able to do both, that is the point of the thing. How is a class instance unable to see methods in the class because they are common to all instances of it ? Dumb, dumb, dumb.
Have you not used static in C++ ? Have you used it particularly in C# ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Christian Graus wrote:
I'll settle for one good reason that an instance of a class cannot know about methods that exist once and once only for all instances of that class.
Its not that they don't know about them; but why make it look like you are making an instance method call when it is a static method call?
Christian Graus wrote:
In C#, a static that is also private is invisible to EVERYONE.
No it isn't, it is visible to that class
class Foo {
private static int bar = 0;
private static void IncBar()
{
bar++;
}
public void DoSomething()
{
Foo.IncBar();
Foo.bar++;
}
} Compiles just fine.
Now I'm going to throw something out which I've told many people before. No matter the language I've always heard complaints about it not having feature x from language y. This isn't language y, if you keep going back to wanting it to be language y you are are just going to infuriate yourself because it isn't. I've now said it for 3 languages (FORTRAN, Java, and C#) and its been true in every one of those cases.
Christian Graus wrote:
It is simply counterintuitive, if a method I am writing can be written as static, for my users to have to type in the name of the class instead of the name of a class instance.
How is it counterintuitive? The method doesn't belong to an instance of the class, I think it is counterintuitive to code a static method call like it was an instance method.
All of the critics have lambasted VB for doing too many things for the developer on the language level, making them lazy. Oddly enough C++ does the same things but no one says a thing! While we were working on the screensaver I think it is safe to say your biggest complaint was that you had to cast everything. Now we have a framework where a bad cast isn't going to ruin anything because the cast will throw an exception if it can't be made. I see that as a good thing. In fact it is close to the dynamic_cast of C++, a better match would be the as statement
IMO it is BAD to not be explicit about what you are doing. Anyone with experience coming from VB will know the problems caused by not being explicit. Maybe its time the VB people teach the C++ people a thing or two .
BTW, if I sound mad its not because of you nor anyone else from CP. My dad is insisting on opening up some security problems on our webserver, but since he pays the bill for it I have no say in the matter. That and he is completely unorganized so the root directory looks like crap
James
"Java is free - and worth every penny." - Christian Graus
|
|
|
|
|
James T. Johnson wrote:
Its not that they don't know about them; but why make it look like you are making an instance method call when it is a static method call?
Because it's more intuitive to the user of the class ?
James T. Johnson wrote:
Compiles just fine.
Apparently.
James T. Johnson wrote:
This isn't language y, if you keep going back to wanting it to be language y you are are just going to infuriate yourself because it isn't.
That's fair, and more to the point, if I try to make C# behave like C++, I will miss out on cool stuff in C#. For example, I am getting into reflection and finding it very cool. But given that C# is clearly modelled at least in part on C++, it's reasonable to ask why this change was made, the syntax looks like C++ but behaves differently, so I assume they thought they had a good reason. I'm still waiting to hear it.
James T. Johnson wrote:
How is it counterintuitive? The method doesn't belong to an instance of the class, I think it is counterintuitive to code a static method call like it was an instance method.
I have a method I want to add to an XML wrapper class I am writing. It takes an XML node and goes through it's children looking for a text node. If it finds one, it returns the value. It's called GetText. I decided to make it static because it does not rely on the internal state of the class, but I imagine someone using an instance of the class to do other things would like to be able to type
myinstance.GetText(myinstance.FindNode("/XML/node/mynode"));
Being forced to remember what is a static method and what is not when all the methods are being used together to manipulate XML does not seem to me like a highly evolved thing to do. It's simply an annoyance.
James T. Johnson wrote:
All of the critics have lambasted VB for doing too many things for the developer on the language level, making them lazy. Oddly enough C++ does the same things but no one says a thing!
Like what ?
James T. Johnson wrote:
While we were working on the screensaver I think it is safe to say your biggest complaint was that you had to cast everything. Now we have a framework where a bad cast isn't going to ruin anything because the cast will throw an exception if it can't be made. I see that as a good thing. In fact it is close to the dynamic_cast of C++, a better match would be the as statement
I am reading the Richter book and now that I understand the as and is keywords, I think I like the C# model better than I did, but I still hate the fact that C# forces me to cast so much, especially in the case of the Clone method, containers, and using values supported in C# but not the CLR, like ( from memory ) short.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|