|
Well, you didn't show the line where you are calling ComboBox.Items.Add
But have you tried this?
try
{
(ctrl as ComboBox).Items.Add(whatevertoaddhere);
}
catch(Exception ex)
{
}
or something of the like.My latest programming adventure was coding the multimedia features for the Rip Ride Rockit coaster at Universal Studios Florida. I love my job.
|
|
|
|
|
It's hard to tell where your 15 choices come from, but I recently had a similar problem. If you're choices are based on a reasonably designed class or classes, you should look at using reflection to dynamically add the controls you need:
foreach (Type mytype in Assembly.GetEntryAssembly().GetTypes())
{
if (type_matches_criteria)
{
(create new control)
(adjust control details and location)
Controls.Add(new_control)
}
}
Then to use your controls:
foreach (Control ctrl in (from Control c in Controls where c (meets criteria) select c))
{
if (ctrl.Checked)
{
ctrl.Text = "Blah";
}
}
|
|
|
|
|
Is it possible to launch an external application, say Excel for example, but then "dock" the launched application into my application (as if it were a component)? This why the user could view my portion in one side of a "split" window, and access the launched application in the other side of the split window - my customer prefers this over just resizing two applications and placing them side-by-side, plus his application is required to run in full screen mode, so this isn't possible, and alt-tabbing is a less preferred alternative.
|
|
|
|
|
|
Thanks
|
|
|
|
|
I've created a DataGridView with one column of type DataGridViewTextBoxCell. I'd like to disable the right click context menu that appears when the cell is in edit mode. I've seen examples with textboxes where you set the control's ContextMenu property to a new ContextMenu object, but this doesn't seem to work for DataGridViewTextBoxCell objects.
I've tried to do the following:
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
{
DataGridView gv = ((DataGridView)sender);
if (gv.Rows[e.RowIndex].Cells[e.ColumnIndex].ContextMenuStrip == null)
{
gv.Rows[e.RowIndex].Cells[e.ColumnIndex].ContextMenuStrip = new ContextMenuStrip();
}
}
Thinking it might do the same, but when the cell enters edit mode, it displace the default (for lack of a better term) context menu.
Any help/incite is much appreciated. Thanks.
|
|
|
|
|
Hello!
I am looking for a way to have one instance of my program talk to another.
I only want one instance of the program open at a time, so I’ve set up a mutex to restrict access. My program also allows the user to launch different froms in the program by using command line arguments. If the user launches a new instance of the program with command line parameters I would like the second instance (the once just launched) to pass the arguments to the first instance, then the second instance will close.
I was wondering if I could store a pointer to the first instance of my program somewhere that could be retrieved by the second? Maybe from the Mutex or something similar, but I haven’t had any luck finding a way to do this.
Thank you all in advance!
|
|
|
|
|
You could always have a socket open and listening too, but I'd probably use the named pipes in the above link.
|
|
|
|
|
Thank you both for your answers! My users are on systems that only have .NET 2.0 and I don’t have the ability to ensure all users have .NET 3.5.
I will use your idea of having a socket open since I already have a server listening (which is why I didn’t want a second instance open). That is a brilliant idea and works perfectly for what I’m doing!
Thank you both again!
|
|
|
|
|
I've been trying to find a way to get the link at a certain point in a LinkLabel.
I've done it with items in a ListView using
Point p = lv.PointToClient(new Point(Cursor.Position.X, Cursor.Position.Y));
ListViewItem lvi = lv.GetItemAt(p.X, p.Y);
I've been able to find the LinkLabel equivalent, PointInLink(), but it's a protected method and I don't know how to access it.
I've been googling for a couple days now and I just can't find an example I can wrap my head around. I was hoping someone could point me in the right direction.
Thanks in advance.
PointInLink() found at http://msdn.microsoft.com/en-us/library/system.windows.forms.linklabel.pointinlink(VS.71).aspx
I'm using VS2008, .NET 3.5.
Edit --------------
Another solution I've been looking at is checking the state of my links, like
foreach (LinkLabel.Link lnk in ll.Links)
{
if (lnk.*State* == LinkState.Hover)
// do something
}
This would work for me, except I cannot find a way to get the link's current state. The lnk variable (used in the loop) does not have a definition for it.modified on Friday, March 5, 2010 3:58 PM
|
|
|
|
|
I have a command line program that launches when My user clicks on a file associated with another program. My program then runs a few checks,setups and launch the other program but I need to Get the Original File Click On and pass it onto the other programs command args. How do I get the Original file Click on file path???
|
|
|
|
|
how do you get your app to launch when a file is clicked with an extension associated to another program???
and is all this happening in Windows Explorer, you didn't specify.
|
|
|
|
|
Sorry. When My users go to install the other program they actually runs my program which in turn installs the other program and disassociates the files that would normally launch the other program and associates those files to my program. The users are using Windows Explorer.
|
|
|
|
|
when the file association (at the Windows level) is with your app, your app will get launched with a command line holding the file spec of the file(s) that got double-clicked/launched. So all it takes is for your app to look at the command line and do its job.
Warning: don't forget to test also with file paths containing spaces!
|
|
|
|
|
|
Sir/Madam,
I want to operate the computer system with software developed in C#. The basic functions.
Kindly guide me in this matter.
|
|
|
|
|
This [^]will be helpful as well as this[^] I know the language. I've read a book. - _Madmatt
|
|
|
|
|
i want to know is by just removing keyboard and mouse, i want to operate the computer by microphone(MIC).
Operations such as typing a document, opening command promt...
|
|
|
|
|
Phrase your questions in a more articulate and specific manner and you may receive better answers. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
see i will remove keyboard and mouse after i log in.
Then i will use the Microphone to do all operations such as typing a document, running a programs.
All operated by human speech..
|
|
|
|
|
This is built into Vista and Windows 7. For earlier versions of windows there are products on the market which will be more accurate and better featured than anything that a single coder can produce, at far less cost. Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
There is a System.Speech namespace you can include in your project.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
|
So you are looking for someone to do it for you? Post to the Jobs Board I know the language. I've read a book. - _Madmatt
|
|
|
|
|
No guidance to development
|
|
|
|