|
Ravi Mahavrathayajula wrote: Now how can I refer to a particular object in the arraylist referring to its respective "key" from the hashtable?
Have you looked at the documentation for the Hashtable class? If you can't figure it out by reading the documentation then buy a beginners book or take a course at a university.
led mike
|
|
|
|
|
Ravi Mahavrathayajula,
What are you trying to do?, eg: whats the problem your trying to solve. Just because its looks a bit complicated for something as simple as storing a list of "Errorcodes".
Regards,
Gareth.
|
|
|
|
|
Thanks for looking into the problem Gareth.
ErrorCodes is a class as shown below.
<br />
class Errorcodes<br />
{<br />
public string Errorvalue;<br />
public string Errorcomments;<br />
<br />
public Errorcodes(string Errorvalue, string Errorcomments)<br />
{<br />
this.Errorvalue = Errorvalue;<br />
this.Errorcomments = Errorcomments;<br />
}<br />
}<br />
Now I actually need to read 3 fields into a loop, but as hashtables cannot process more than 2, I've read one as key and stored the other 2 fields as objects of the class error codes in a hashtable. Now as I retrieve a "Key" from the hashtable, its respective "Value" field must also be retrieved. But since the Value field in this case is actually an object of ArrayList, I was confused how could I retrieve a particular object that I needed.
|
|
|
|
|
Ravi Mahavrathayajula wrote: I was confused how could I retrieve a particular object that I needed.
You have to cast it from object to ArrayList. NOTE: If you are using .NET 2.0 or higher you should use Generic Containers to avoid the casting.
led mike
|
|
|
|
|
Ravi Mahavrathayajula wrote: but as hashtables cannot process more than 2, I've read one as key and stored the other 2 fields as objects of the class error codes in a hashtable.
Sounds like you should use Collection or List<>. What happen if the key duplicates?
|
|
|
|
|
The "key" is unique and doesn't duplicate in this case. Please correct me know if I misunderstood your question.
|
|
|
|
|
hello
Can i insert a c# code for getting the current date in my code snippet.
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
|
hello
I want to create a code snippet that generate to me the following
//Elie begin : date 12/12/2008 : Fixing ......
//Elie end
i can't generate the date automatically. Plz any help
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
ellllllllie wrote: I want to create a code snippet that generate to me the following
//Elie begin : date 12/12/2008 : Fixing ......
//Elie end
Do not. Since you are using source control (of course you are, right?) this kind of comment is not needed. What is 100000000x more useful in case of nontrivial fixes is detail explanation what you fixed and how, or perhaps bug ID to your bug tracking system if you are using any (and detailed info is there).
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
|
I would probably use a macro instead. Put it on a hotkey for convenience.
I wrote one to put a review comment for when I go through files and do a
preliminary review.
Sub ChangeLastReviewDate()
DTE.ExecuteCommand("Edit.Find")
DTE.Find.FindWhat = "Last Review:"
DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.MatchCase = False
DTE.Find.MatchWholeWord = False
DTE.Find.Backwards = False
DTE.Find.MatchInHiddenText = True
DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
DTE.Find.Action = vsFindAction.vsFindActionReplace
DTE.Find.Execute()
DTE.Windows.Item(Constants.vsWindowKindFindReplace).Close()
DTE.ActiveDocument.Selection.EndOfLine(True)
DTE.ActiveDocument.Selection.Text = "Last Review:" & Now() & " [Done by: SRP]"
End Sub
"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand
|
|
|
|
|
Hi,
My situation is that i have one checkBox and datagrid. I want to do that: if i check checkBox
the datagrid shows only rows with value 0 in spacific colum.
Can enyone tell me how to do this?
thanks M
|
|
|
|
|
Metik wrote: Can enyone tell me how to do this?
I guess you'll have to add a handler for the check-box event of your interest and write the code to redraw your datagrid to display the columns of your interest there.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
1.Create an IceCreamConeException class whose constructor receives a string that consists of an ice cream flavor and number of scoops.
2. Create an IceCreamCone class with two fields:
• IceCreamFlavor
• Scoops
3. The IceCreamCone constructor calls two data-entry methods:
• GetFlavor(), which throws an IceCreamConeException if the flavor isn’t one of the following: vanilla, chocolate, strawberry, peach, or banana.
• GetScoops(), which throws an IceCreamConeException when the scoop quantity exceeds 3.
4. Create a program that establishes several IceCreamCone objects and handles any throw IceCreamConeExceptions.
5. Save your program.
6. Now “build” your program
Can sumone plz help me with this..its urgent....
hey
|
|
|
|
|
shaheen13 wrote: Can sumone plz help me with this..its urgent....
No, it homework. Go do it yourself!
|
|
|
|
|
shaheen13 wrote: 1.Create an IceCreamConeException class whose constructor receives a string that consists of an ice cream flavor and number of scoops.
2. Create an IceCreamCone class with two fields:
• IceCreamFlavor
• Scoops
3. The IceCreamCone constructor calls two data-entry methods:
• GetFlavor(), which throws an IceCreamConeException if the flavor isn’t one of the following: vanilla, chocolate, strawberry, peach, or banana.
• GetScoops(), which throws an IceCreamConeException when the scoop quantity exceeds 3.
4. Create a program that establishes several IceCreamCone objects and handles any throw IceCreamConeExceptions.
5. Save your program.
6. Now “build” your program
Can sumone plz help me with this..its urgent....
Not sure about the rest of it, but Ctrl+S will help with step 5 and Ctrl+B should get you past step 6.
Good luck with the others. Be sure to post back with the grade you get!
Knowledge is hereditary, it will find its way up or down.
Luc Pattyn
and since what every time when i want to add button to this control one add two times
posted in C# forum
|
|
|
|
|
Malcolm Smart wrote: 1.Create an IceCreamConeException class whose constructor receives a string that consists of an ice cream flavor and number of scoops.
2. Create an IceCreamCone class with two fields:
• IceCreamFlavor
• Scoops
3. The IceCreamCone constructor calls two data-entry methods:
• GetFlavor(), which throws an IceCreamConeException if the flavor isn’t one of the following: vanilla, chocolate, strawberry, peach, or banana.
• GetScoops(), which throws an IceCreamConeException when the scoop quantity exceeds 3.
4. Create a program that establishes several IceCreamCone objects and handles any throw IceCreamConeExceptions.
5. Save your program.
6. Now “build” your program
Can sumone plz help me with this..its urgent....
Not sure about the rest of it, but Ctrl+S will help with step 5 and Ctrl+B should get you past step 6.
Good luck with the others. Be sure to post back with the grade you get!
Good advice. Of course, I'm disturbed at how poor the requirements are for this. For instance, a constructor calling either a poorly named method, or a really dodgy implementation. I'm sorry, but this whole mess would need to be redesigned and the tutor will be awarded an F for this very poor design.
|
|
|
|
|
Agreed. Poorly designed assignment, starting bad habits early.
"Run for your life from any man who tells you that money is evil. That sentence is the leper's bell of an approaching looter." --Ayn Rand
|
|
|
|
|
Malcolm Smart wrote: and since what every time when i want to add button to this control one add two times
Can you give me an original link to that gem?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
shaheen13 wrote: Can sumone plz help me with this..its urgent....
Sure. When you come round to my house and paint the kitchen for me - oh, and weed the garden. Then I'll code it up for you.
|
|
|
|
|
I see where you're coming from Pete but I think you're being a bit harsh... Gone are the days when students would be in class, make some notes, read the handouts, read the recommended text books, look at API documentation, or even ask the tutor. Where would we all be without google and code project hey!?
|
|
|
|
|
nelo_ wrote: I see where you're coming from Pete but I think you're being a bit harsh... Gone are the days when students would be in class, make some notes, read the handouts, read the recommended text books, look at API documentation, or even ask the tutor. Where would we all be without google and code project hey!?
You're right. It's far too harsh for me to expect somebody to actually be able to do something for themself. Obviously, my plumber just asks for somebody else to come and fit the bath for me, and he in turn asks somebody else - I suspect that there's only one plumber doing everybody's work for them. This explains why nothing ever gets done - that poor sod's far too busy.
|
|
|
|
|
Pete O'Hanlon wrote: I suspect that there's only one plumber
And he is actually the original poster, trying to cross train to be a developer!!
I'm sorely tempted to take you up on your painting / weeding offer though Pete, I'm so far behind with this project it's untrue. I'm packing the kids and wife off you with paint brushes and spades in hand.
Knowledge is hereditary, it will find its way up or down.
Luc Pattyn
and since what every time when i want to add button to this control one add two times
posted in C# forum
|
|
|
|
|
Malcolm Smart wrote: I'm sorely tempted to take you up on your painting / weeding offer though Pete, I'm so far behind with this project it's untrue. I'm packing the kids and wife off you with paint brushes and spades in hand.
Cool. When will I expect them? Have you posted them first or second class?
|
|
|
|