|
Use this:
ComboBox1.Items.Add("test");
ComboBox1.SelectedIndex = ComboBox1.Items.Count-1;
|
|
|
|
|
I think your problem is that you want to change the value of an entry by typing over it. The problem being that once you start typing you loose any reference to the item you want to change. Perhaps an option would be to handle to OnEnter event and store the selected index, then when you detect the 'Enter' key you can use that index to change the value of the correct item.
something like...
int currentIndex = -1;
void OnEnter(object sender, EventArgs e)
{
currentIndex = comboBox1.SelectedIndex;
}
void KeyDown(object sender, KeyDownEventArgs e)
{
case (char)Keys.Enter:
imageViewer1.RenameShape("test");
comboBox1.Items[currentIndex] = comboBox1.Text;
comboBox1.Text = "";
break;
}
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thank you for all of the replies.
I got everything working now there was alot to it as the shapes can be selected by the mouse too so this also had to change the comboBox :
void imageViewer1_Clicked(object sender, EventArgs e)
{
if (imageViewer1.ListOfShapes.Count > 0)
{
for (int i = 0; i < comboBox1.Items.Count; i++)
{
if ((string)comboBox1.Items[i] == imageViewer1.ListOfShapes[imageViewer1.SelectedShapeIndex].Name)
{
comboBox1.SelectedIndex = i;
m_comboBoxCurrentIndex = i;
}
}
}
}
Above and below (solution) may not be pretty but it works
case (char)Keys.Enter:
if (comboBox1.SelectedIndex != -1)
{
m_comboBoxCurrentIndex = comboBox1.SelectedIndex;
comboBox1.Text.Remove(0, comboBox1.Text.Length);
imageViewer1.RenameShape("test");
comboBox1.Items[m_comboBoxCurrentIndex] = "test";
comboBox1.Text = "";
}
Thanx George
|
|
|
|
|
Hi, i'm having this problem and can't find a solution.
This image describes all the problem.(Image)
Thanks a lot.
|
|
|
|
|
Please post your problem directly in the question and not thru external links. There are many people like me who are behind firewalls and can't access those links.
|
|
|
|
|
There are only two places the dll will be searched if you have added them as reference
1. Current working directory
2. C:\windows\system32 (till XP).
You can place your dlls in any of these places. Otherwise it won't get loaded
|
|
|
|
|
Have you ever heard of anything called assembly probing ?
|
|
|
|
|
Shameel wrote: Have you ever heard of anything called assembly probing ?
No
|
|
|
|
|
You can actually instruct Fusion (the assembly resolution subsystem of CLR) to check subfolders (in your app's folder) for referenced assemblies. This has to be done in the application's config file.
You can even compile referenced assemblies as embedded resources in your app and dynamically extract them and provide it to Fusion. For an example of this, visit www.albahari.com
|
|
|
|
|
Didn't know that. Thank you very much for that.
|
|
|
|
|
|
You have some options:
1. Search Google.
2. Write on your own.
3. Try RentACoder and pay someone to do your work.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
You missed an option:
4. Fail.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
That is the "result" regardless of the option chosen. If not in this course, somewhere later on.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
unfortunately I have seen interns (in their last year) who've proven that statement wrong .
|
|
|
|
|
Asking for source code is considered rude in CP. Read the guidelines first before posting questions.
What have you tried so far? Try something on your own first.
|
|
|
|
|
How about you quit your pathetic attempt at being a student and do something you actually have a chance at!
I assume you are following this career choice because you think its easy money? Well, 1 - it's not easy, and 2 - because of mass amounts of idiots, it's becoming harder for the deserved people to find a job, and even then, one that will pay well!
Now, go quit your course!
End
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Although I agree with your sentiment, please read
HOW-TO-ANSWER-A-QUESTION[^]
No insults welcome
Kind of takes the fun out of some answers tho.
|
|
|
|
|
Maybe we should have a standard 'students please do your own homework' page we can all link to whenever a post like this comes up.
|
|
|
|
|
|
Yeah, I have read that.
There is also How to get an answer to your question[^], if the OP disregards that then I reserve the right to do the same for the answer one.
I think that is fair, is it not?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Sure I won't complain
But look at it this way, the 'how to answer a question' thingy might restrict you somewhat but doesn't stop you from being creative in your answers
|
|
|
|
|
Sometimes I prefer to be destructive.
Anyhows, I was merely giving career advice and, in my opinion, have not insulted the OP at all
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Alas, the 'how to answer' item was added because some people[1] were getting more and more agressive in the answers to retards, nitwits and the ESN[2]. As a reault Dad said we have to play nice or we won't be allowed to come over any more.
[1] I reserve the right to pretend it was not me never.
[2] Not 'Educational Special Needs' but the older meaning. The new one is just a backronym.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
The worst thing...
I got the answer to what he wanted with a simple google search.
Saying you can only find the solution indicates you aren't trying hard enough...
|
|
|
|