|
zuhx wrote:
Does any one know if it is possible to add a form to a panel?
Yes, it is possible, but not really recommended unless you change the FormBorderStyle.
MyForm form = new MyForm();
form.TopLevel = false;
form.Location = new Point(5, 5);
this.Controls.Add(form);
form.Show(); The only two things you HAVE to do is set TopLevel to false, and call Show . Don't forget that if the user clicks the close button on the form then the form object get's Dispose'd -- yet another reason to change the forms FormBorderStyle or at least hook the form's Closing event.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
James T. Johnson wrote:
Yes, it is possible, but not really recommended unless you change the FormBorderStyle.
I do need to change the FormBorderStyle. Can you give a little more detail on why it is not recommended? Is it only because of changing the FormBorderStyle or are there other reasons as well?
|
|
|
|
|
zuhx wrote:
Can you give a little more detail on why it is not recommended?
I don't recommend adding a form to a panel UNLESS you change the border style. Otherwise you wind up with a form that can be moved around (not so bad if that is the intended purpose) but it can also be closed which can be a problem.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
I am writing a compiler using C# and the System.Reflection.Emit classes. The problem I am having is that I go through and create my classes for my language using TypeBuilder but I can't use those classes until I call CreateType. This wouldn't be a problem except that I potentially have to define instances of the class within the class (and therefore before I call CreateType). An example of this would be a linked list node that contains an instance of itself as the next node.
So the real question is if there is some way to get the System.Type of a TypeBuilder before calling CreateType. Or alternately, is there some way to add functions and variables to an already created type that I still have the TypeBuilder for but have called CreateType? I need this because many things need a System.Type and I need to allow users to use the classes they create while programming.
Thanks
|
|
|
|
|
I feel your pain. I abandoned IL , and went with codedom. , but I believe inheritance will solve your problem here.
<a TITLE="See my user info" href=http:
|
|
|
|
|
Hmm, TypeBuilder itself is derrived from Type, perhaps that's what you need.
I also see the following remark in the documentation for TypeBuilder:
To retrieve a Type object for an incomplete type, use ModuleBuilder.GetType with a string representing the type name, such as "MyType" or "MyType[]".
Burt Harris
|
|
|
|
|
How do I find out if the system is hiding shortcut keys?
So I know how to draw the text on the button control.
If there is some simple way that I have overlooked let me
know.
Thanks You
Bo Hunter
|
|
|
|
|
Refer to the ShowKeyboardCues property on the Control class. There are a few events you should handle as well in case the user's preference has changed. The above property has some other topics in the "See Also" section that you should reference.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
I'm using a WebControl TreeView and whenever I add nodes, (reguardless if I add them in the C# code, ASP code, or using the TreeView properties) they show up as just plain text. I tried openeing a whole new project, thinking it was someting wrong with the project I added it to, and adding it as a Web Control, neither worked. Any help would be greatley appriciated.
.............Zack.............
Developer Extraordinaire
&&
Full Time Geek
"It's all about function over form. I mean, look at NASA. Their code isn't formatted correctly and their stuff looks crappy, but they'll get you to the moon."
"And the geek shall inherit the earth..."
GCS\P\SS d- s-:- a-- C++$ U--- P--- L- E- W++ N o K-? w+++ O++ !M-- V PS+ PE Y+ PGP t+ 5+ X+ R++ tv++ b++ DI++ D+++ G+>G++++ e* h- r++ y+
|
|
|
|
|
gah! I replied once before but CP said there was an error, this time it doesn't look like the message was still posted.
Your post triggered something in my memory, but I don't know what exactly. I think someone else may have had similar problems on the DOTNET lists. I did a quick search but couldn't find it, but maybe you can come up with some better hits.
http://discuss.develop.com[^]
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
Hey All,
I remember in vb6 you were able to make a single control like a button, visible on all tabs of a tabbed control by holding down alt or something like it while your throwing the control on the form. Does anyone know if this exists in .net?
Thanks,
Ryan
|
|
|
|
|
I just ended up putting the control behind the tabbed control and i use the bringtofront method whenever i refresh the screen. I just thought there might still be a shortcut.
Thanks,
Ryan
|
|
|
|
|
Hi,
Hope someone can assist with this.
I've got a servicedcomponent running under COM+.
The class requires a new transaction. Connects to a SQL2000 database server running on Windows Server 2003. My development machine is also Windows Server 2003. Neither of the machines are on the domain. Logging on locally to my machine as administrator.
Inside the class a new sqlconnection is created. as soon as open is called on the connection i get a COMException with the following message :
"The transaction has already been implicitly or explicitly committed or aborted"
The method is in a transaction, calling contextutil.isintransaction returns true.
Before this code is called several successfull database commands have been run. None of them from serviced component.
Other client machines, not win2003 server, is running without problems and connections work.
I suspect that this vague error message has got something to do with security or DTC??
If anyone can assist me I would appreciate it!
Armand
|
|
|
|
|
Is there really no class in dot net to set file association? There must be, right, I can't find it. (That would be such a massive oversight by MS if there wasn't one!)
So can someone point me to a tutorial to do file association in dot net, and also something that tells me how to do resources (like, what is IconPath and IconIndex? I found stuff on file associations but it assumes I know how resources work and I have no clue. I can embed icons in my dot net app as resources, but what is the "icon index" number of the icon once it's embedded?)
thanks
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
I want to draw a ruler and when I move a scrollbar, it can redraw. How should I do ?
Thank you !!
|
|
|
|
|
Hi,
I'm working on a ruler control, but it won't be ready until about 2 months from now (because there's more pressing things at hand right now).
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
:-DI want use DTC to manager distribute transaction directly .I don't like COM+,because of i only need transaction manager,and that i'm worry about overhead.
So,i wanna program DTC as VC++(use olbdb or dblib) in dotnet.
I import the DTC interface through PInvoke,but i can't use ado.net/oledb.net enlist in DTC transaction,want me to wrap native DAO?
good good study,day day up
|
|
|
|
|
There are a bunch of Attributes that mimic the functionality of COM+ ( dtc, opbject pooling, queued components, J.I.T.A., etc. ).
I think they're in System.EnterpriseServices. Hope this helps....
|
|
|
|
|
Thank you!But I try to find something in System.EnterpriseServices,draw a blank..........~~~>_<~~~~~
Who can help me?
good good study,day day up :<)
|
|
|
|
|
Hi friends
I want to pass a SAFEARRAY of BSTR from a unmanaged code to a managed assembly. My constraint is I can accept just an IntPtr in the managed code. I tried passing SAFEARRAY*, but could not convert it to Array or string[] in the managed code. Can anybody suggest how to achieve it?
vikram
|
|
|
|
|
Use the MarshalAs(UnmanagedType.SafeArray) attribute or MarshalAs(UnmanagedType.Bstr) . If necessary, combine it with the [in] and [out] attributes.
|
|
|
|
|
I have been trying to use unique numbers, but this does not seem to work. The data wizard will always leave them out, and I cannot find a value similar to unique number. Anyway, so I have thought, maybe I should make my own. So I want to know the best way to do this.
Do I, count the number of records, and add one (bearing in mind, data will never be deleted), or do I search through all records, and find the largest number in the column, and add 1 to this? If so for the last one, how would I do that? Would a while loop or a for loop be better? Lastly, in SQL, the column is set to uniqueNumber. Should I use bigInt?
|
|
|
|
|
Seems a bit odd replying to myself, but I found a solution, so this is for anyone who ever has a similar thing. This is if you want to create your own unique number. The code is:
int test1 = 0;
int test2 = 0;
for (int i = 0; i <= yourDataSet.yourTableName.Count - 1; i++)
{test1 = yourDataSet.yourTableName[i].theID;
if (test2 <= test1)
{test2 = test1 + 1;
}}
Sorry about how I compressed this. It counts the number the number of rows (in the format 1, 2, 3, etc, which is why you must - 1, else you will get an error). The last part just compares the numbers.
|
|
|
|
|
Normally you would just set the column as read only and let SQL autoincrement it, or create a GUID.
<a TITLE="See my user info" href=http:
|
|
|
|
|
You could also setup in the DataSet that the column is auto-increment. So whenever you insert a new record, it will create a new ID for you.
There is a problem with this though, as the ID always starts at 1 (or if populated from the Db, the last ID). So if your DB has 5 records in it with IDs of 1 though 5. And you retrieve ID 3 into your DataSet and add a new record, the ID will be 4. Now if you try to save it back to the database, it will error.
Hope this helps
|
|
|
|