|
Hi All.
public enum tipologie_oggetti { moda,modb,modc}
i would like to add "modd" using a combobox or a textbox or any other controls so to have as a result :
public enum tipologie_oggetti { moda,modb,modc,modd}
I don t know if it is possible.thanks
|
|
|
|
|
What is the context of this question?
Controls usually don't change the source code.
|
|
|
|
|
It is exactly what i nedeed.Controls can not change code.So my next question is: what if i wanted to enable the user to add a new item to my enumerator?
|
|
|
|
|
Well, you kind of can't. (and you kind of can, but let's not go there yet)
It sounds like you need something else, perhaps a Dictionary<TKey,TValue> of some sort? What are you doing with it?
|
|
|
|
|
I'll try to explain it better. I put some serialized data in a 3d object(guid). one of them is my enumerator.Therefore my objet "obj1" contains tipologie_oggetti.moda and
"obj2" has tipologie_oggetti.modc. i would like to enable the user to create a new enumerator(tipologie_oggetti) item and add it to his 3Dobject as a serialized data.
|
|
|
|
|
Yeah, we know what you're doing. You're just using the wrong construct to do it.
Enums are a collection of constant values used in your source code to improve readability, consistency and supportability of the code.
That are NOT used as variable length lists of user data, which is what you're trying to do. Use an appropriate construct, such as a List<t> or Dictionary<t> if you're going to left users modify this list of names and values.
|
|
|
|
|
I think you're right.'ll use a dictionary. thank you all for your cooperation.
|
|
|
|
|
In that case, this should be considered data edited by the program and not an enumerator. You cannot use an enum in the way you want.
|
|
|
|
|
Enums are a structured (ordinal) collection of integral, value-type, Constants. You might say they are "tightly bound" at compile-time.
Two days ago I responded to a question about Enums here on the C# QA Forum: [^].
I hope you might find the content of that response, the comparison of an Enum with its (static) Class equivalent, and the links included in it, helpful.
It is possible to modify an Enum at run-time, but you have to use Reflection to do it, and I'd highly recommend you not do that for performance reasons, as well as reasons of unnecessary code complexity.
“I'm an artist: it's self evident that word implies looking for something all the time without ever finding it in full. It is the opposite of saying : 'I know all about it. I've already found it.'
As far as I'm concerned, the word means: 'I am looking. I am hunting for it. I am deeply involved.'”
Vincent Van Gogh
|
|
|
|
|
thank to everibody.i have to go now .my wife and my daughter are calling me.i will read you link billwooddruff as soon as it is possible .
|
|
|
|
|
You mean "enumerations" and, as said, you want something else.
|
|
|
|
|
you're right. your help and that of those who have patiently helped me a lot to understand. through the effort of those who know the more you grow faster
|
|
|
|
|
microsoft translator api doesn't translate text with proper meaning it only takes word to word mean in c# \
means when i want to translate this sentence
"I WANT YOU TO WRITE THESE"
it does translate this sentence as
मैं इस पढ़ने के लिए आप चाहते हैं in hindi which is not proper .also it doesn't take phrases into consideration
pls give me a solution on this i am tearing my head on this.
|
|
|
|
|
You will never get perfect translation when doing it through software, since a phrase in one language may be interpreted in different ways, and sometimes will not make sense in another language. Consider the English phrases: Time flies like an arrow, fruit flies like a banana.
Veni, vidi, abiit domum
|
|
|
|
|
There is no solution.
That is, unless someone comes up with artificial intelligence that can comprehend human conversion context. That hasn't happened yet, but you're free to try all you want!
|
|
|
|
|
Hello sir,
i want to store invoice number of a document, while scanning or capturing the document. Is there any possible way..?
Please help me sir.. i'm waiting for your valuable feedback
|
|
|
|
|
Unless you enter the number through your own software, you will not be able to capture this data directly.
You could, of course, scan data on the image and with image recognition and maybe read invoice value out. That approach won't be an easy one though.
|
|
|
|
|
i have seen on ADP careers website... when i upload a resume, it screens my resume and automatically stores in textboxes. How it has been done sir.. hope this example gives me the solution.
waiting for your valuable feedback sir...
|
|
|
|
|
i want to insert a image into codeproject question, because of clearly express my question !!
Thanks & Regards
AR
|
|
|
|
|
You can't. The best you can do is upload your picture to an image hosting site, like Flickr, and paste the link to it in your post.
And if you rely on nothing but a picture to "ask" your question, you're going to be flamed, not helped. A picture is definitely NOT worth a 1,000 words.
|
|
|
|
|
Thank you..
Thanks & Regards
AR
|
|
|
|
|
Sorry. You can't insert images into a question.
Upload the image elsewhere and post a link to it here.
|
|
|
|
|
Just to add to the others comments: You can't, for good reason. This is a work-friendly site, and we want to keep it that way, so the people in charge of corporate networks don't block the site. If that happened, a lot of us would be unable to access info here which is really useful to do our jobs. The problem is that once you allow direct image posting you have to moderate the forums as well: every single question has to be vetted to make sure that nothing inappropriate is posted - because there are enough morons out there who will and do post images to any site because it s "funny". It wouldn't take many of those pictures to start us onto a blacklist, so we would have to moderate each and every question, answer, comment, and message. We don't have the resources to do that; we are all volunteers, and that kind of thing takes time and slows the posting of questions and responses. It's also serious boring, and people don't generally volunteer for dull stuff.
So instead, all images are banned, and moderation can be a lot simpler - it can be as we do it now: after the fact.
Ok, that means the one question in a thousand which would be improved by a question suffers. But the other 999 get a good, timely response. And to be honest, if you need to show us a picture, you are probably asking the wrong question anyway...
|
|
|
|
|
Hi Guys,
Can you please help me on this one, i have this function that i use to get the value of a registry from a remote computer, this one works fine for string values but i could not get binary values using this method, even if i change the
registry.GetMethodParameters("GetStringValue")
registry.InvokeMethod("GetStringValue", inParams, Nothing)
with
registry.GetMethodParameters("GetBinaryValue")
registry.InvokeMethod("GetBinaryValue", inParams, Nothing)
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim servername As String = "192.168.71.127"
Dim options As ConnectionOptions = New ConnectionOptions()
With options
.Username = "Administrator"
.Password = "mypassword"
.Authority = "ntlmdomain:DOMAIN"
.Impersonation = ImpersonationLevel.Impersonate
.Authentication = AuthenticationLevel.PacketPrivacy
End With
Dim scope As ManagementScope = New ManagementScope("\\" & servername & "\root\default", options)
scope.Connect()
Dim registry As ManagementClass = New ManagementClass(scope, New ManagementPath("StdRegProv"), Nothing)
Dim inParams As ManagementBaseObject = registry.GetMethodParameters("GetStringValue")
inParams("sSubKeyName") = "Software\Microsoft\Windows NT\CurrentVersion"
inParams("sValueName") = "CurrentVersion"
Dim outParams As ManagementBaseObject = registry.InvokeMethod("GetStringValue", inParams, Nothing)
MessageBox.Show(outParams("sValue").ToString)
End Sub
IMO
|
|
|
|
|
This should probably be in the VB forum...
But, do you get any kind of error?
|
|
|
|