|
It compiles okay but when I run it I get this error:
An unhandled exception of type 'System.ArgumentException' occurred in System.Windows.Forms.dll
Additional information: A circular control reference has been made. A control cannot be owned by or parented to itself.
|
|
|
|
|
You cannot call data.Controls.Add(data), where "data" is any object.
Jeff
|
|
|
|
|
Then what would I put there? The Form? That would make sense I'll try that.
[Edit Nope that didn't work]
|
|
|
|
|
What command are you currently using?
|
|
|
|
|
this.Controls.Add( (PictureBox)PicBoxes[ row, col ] );
if your table is not of type PictureBox.
read documentation to classes which you use. write PictureBox class in google and you will have everything you need
|
|
|
|
|
Sick. Thanks a bunch Ermak!!
|
|
|
|
|
Jordanwb wrote: I'm not too familiar with object oriented programming. I'm used to C++
That's just mind blowing. That also has nothing to do with this, the form has a Controls property, which has an Add method, and if you open your brackets, intellisense will tell you what to put in there.
Jordanwb wrote: I kinda figured out through trial and error
you'd do better to buy a book and work through it
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
is there any way to host a java applet in windows forms without using a WebBrowser control? i'd like this to be as lightweight as possible (ironic as that sounds). i searched the web and couldn't even find an example in native code.
|
|
|
|
|
zildjohn01 wrote: i searched the web and couldn't even find an example in native code.
There may not be any examples. However since all the browser authors did it, it must be possible right? All you have to do is recreate whatever work they all did and presto, you're done.
|
|
|
|
|
led mike wrote: recreate whatever work they all did
why didn't i think of that? this'll be simple! *downloads firefox source code* (sarcasm)
that code doesn't tell me a thing, i don't even know where to start. if i think about it though, didn't sun (and microsoft, and other vm devs) write the browser plugins themselves? meaning instead of just hosting the applet, i'd have to simulate a browser environment...
this might be more work than it's worth...
|
|
|
|
|
zildjohn01 wrote: this might be more work than it's worth...
Duh
|
|
|
|
|
ok that was mean... lol. WebBrowser it is. i guess i'll just SetParent the java window or rewrite the html and strip the ads out
|
|
|
|
|
zildjohn01 wrote: i guess i'll just SetParent the java window or rewrite the html and strip the ads out
Keep in mind you never actually stated the problem you are trying to solve. Rather you asked how to accomplish a specific solution.
|
|
|
|
|
Is the MCISendString function in winmm.dll suitable for playing the music in a game? I would use wave files with the PlaySound command but file sizes are too large!
Thanks
|
|
|
|
|
I am attempting to make a set of textboxes that will allow dragdrop operations. I am inheriting from RichTextBox in my class and have added the following code...
...
// Only allow copy if this textbox is readonly (cannot move from this box)
if (base.ReadOnly)
this.DoDragDrop(this.SelectedText, DragDropEffects.Copy);
...
protected override void OnDragOver(DragEventArgs drgevent) {
// Set the effect, based on keys pressed and drgevent.AllowedEffects
}
The problem is that drgevent.AllowedEffects is ALWAYS (Move|Copy|Scroll). Then, when I set drgevent.Effect to DragDropEffects.Move (since I have no way to see if the source is readonly), I get the cursor indicating that NO dragdrop operation is allowed. Is there any way for me to get the value passed into DoDragDrop, or at least see if Move is allowed by the operation so I can set drgevent.Effect to Copy? Thanks,
Jeff
|
|
|
|
|
For anyone who is having the same problem, I decided to go with a very hacky solution that only solves some cases, but it is the best I can figure since I am finding it impossible to get help or find a solution anywhere online. I ended up making a static variable (and a lock) within my DragDropRichTextBox class, which stores the allowed operations. Then, in the DragOver event handler, I and (operator &) my allowed effects with drgevent.AllowedEffects to determine what the "real" effects are. As you can imagine, if the source is read-only and is not of my class type, my RTB's will not allow a dragdrop operation unless the user is depressing the ctl key (indicating a copy operation). If anyone has a cleaner solution that works for external sources, I would still like to hear it. Thanks,
Jeff
|
|
|
|
|
This is stressing me out.
I am trying to read word documents at the moment by loading them in as plain text into a hidden richtextbox, then I take that text and use regex to "attempt" to extract the words from the unicode.
I have so far been somewhat unsuccesfull as their is always garble unicode left.
Does anyone know any regex expressions that remove unicode from a string?
If you are wondering why im doing it in this fasion, it is the fastest way I have found to read word docs. I have tried to use WordApplication classes, and OfficeReaders, and they are either slow or error prone. I thought about using Iwordbreaker, but that skyrocketed over my head and dont know where to begin their, plus you need a license.
My c# app is working great now, and its almost ready to go live, its just these bloody word documents.
If anyone can help I would greatly appreciate it.
Thanks
Jeremy
|
|
|
|
|
I don't understand, a Word doc is NOT just rich text. How is this working ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I use the load method that comes from a richtextbox variable, I point it at a word doc, and I choose the plain text option, it loads the text into the richtextbox with a combination of junk and all the actual words in the word doc. I then transfer the text from their in to a string. Its just the matter of getting rid of the junk. Usually all the text in the word doc is tucked away neatly in the middle of the junk, but you get some \\'07 and \par's in their sometimes.
|
|
|
|
|
My question is related to changing the window state of an application prior to opening the app. I am attempting to open a new instance of MS Word from my application so I can interact with the Word API. I used to do it by asking for an instance from the Windows Com object, but that does not guarantee that I get a new instance. To prevent undesireable effects on already open instances of word, I decided to take this new route. However, I want the new instance of word to open in a hidden state, so the user never sees the instance on his or her screen. I tried using the WinApi ShowWindow function after instantiating the class, which is taking 7 ms to both instantiate Word and make the call to ShowWindow. However, it takes the UI about 200 ms to actually hide the Word application. Does anyone know a way to either
1: Assign a handle to a window prior to opening it, so the properties on that handle are carried into the new app (so I could call ShowWindow BEFORE instantiating word), or
2: Instantiate an application from the command line where you can specify the initial window state, or
3: Speed up the refresh of the main UI so the Word window is hidden in less time, or
4: Tell the windows com object to always create a new instance when you ask it for a word app.
Thanks,
Jeff
|
|
|
|
|
I have a fairly simple winform that has several textBoxes, one listbox and one combobox. I have the listBox bound to a field in a table (table1), when a user clicks on an item in the listBox the textBoxes are bound to that table so they display the other data columns for that record. The comboBox is bound to another table (table2) in the dataset that is merely a lookup table. The "Selected Value" of the combobox is bound to one of the colums in table1. This results in the appropriate value being selected in the combobox list. The comboBox has been changed to type "DropDownList" so the user cant type in the box, they can just select one of the pre-existing values in the comboBox. This all works great. The problem occurs when I try to change the selected value in the comboBox. The value does not update in the database when I call the update() method of the table adapter. If I change one of the textBoxes I call a function that ends the current edit ------this.BindingContext[ds_form_contacts, "table1"].EndCurrentEdit(); ------- then calls table1TableAdapter.Update() . This works fine, but if I change the comboBox, I call the same function and the value for the comboBox does not update. If I change the comboBox value then change one of the textBoxes the newly selected value for the comboBox will get updated in the database. I can post code if it helps. All of the binding was done in the designer in vs2005
thanks, -Kevin
|
|
|
|
|
Oh C# gurus, surely someone has the answer to my burning binding question....
anyone????
anyone????
Bueller????
Please....
-Kevin
|
|
|
|
|
I was able to get one step closer. I added a function to handle the SelectionChangeCommited event. In the function I added code to force the rowstate to be "Modified".
((DataRowView)this.tblgroupsBindingSource.Current).Row.BeginEdit();
Interestingly enough this works only if I select the same value in the comboBox twice in a row. The first time it does not change the rowstate.
Thoughts?
|
|
|
|
|
Sorry, Scratch that. The BeginEdit() has no effect on the situation. I removed it and it still does work when you select the value from the combobox twice in a row.
I put a MessageBox in just after the endcurrentedit() to check the state of the row. The first time through it is Unchanged, but when I select it again it is Modified.
thoughts?
|
|
|
|
|
I have a C# application that calls a MySQL procedure and writes data to the db. All of the fields get populated properly but for the ID field, which is my PK field. It populates the field with an empty string instead of the value. the ID field is a varchar field.
When I try a direct insert through the MySql Query Browser, it populates the field correctly, but when using the C# code/appl. the above issue occurs.
What could the issue be?
|
|
|
|