|
How would you like us to screw it up? You can start by changing random letters in variable and class names so that it will not compile. If you'd also like some runtime errors, change the name of a couple of stored procedures.
abidkayani1 wrote:
mSqlCommand.Parameters.Add(arparam);
There is no overload of SqlCommand.Parameters.Add that accepts an array of parameters as an argument.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Hi,
I have a rather simple problem, yet I can't find an acceptable solution. It isn't much of a problem for users running my application at high resolution (1280x1024 for example), but it really is for 800x600 users (too bad they still exist!)
My application is a MDI and I use FormStartPosition.WindowsDefaultBounds for each child form in order for them to open underneath the previous one (cascade).
The problem is that if I open 3 or 4 windows, a scrollbar shows up on my MDI form and the user needs to scroll to see the new windows. It happens even when no windows are open (ie: 4 windows were opened, then closed, the user will need to scroll to see the next opened window because it is not positionned at the top of the screen like it should).
Is there an easy solution to this? Anyone else having this problem?
Thanks!
Carl
|
|
|
|
|
You would have to track the position of the last form you opened. Then add whatever offsets you need in order to keep the next window inside the client area. You would be managing the position and size of the child forms yourself. Simply create a new instance of your child form, set its position and size properties, then show it.
RageInTheMachine9532
|
|
|
|
|
Isn't supposed to be done automatically for me???
|
|
|
|
|
The Default behavior doesn't take into account the size of the child window your opening... so no, it won't do it for you.
The Default behavior will walk down the parent window's client area adding up to 10 child windows stepping down and to the right until the new child window's title bar is half way down the client area of the parent window. It will then start at the top-left corner of the parent client area again and start over. It will do this without any reguard to the size of the child windows...
So if you want the entire child window inside the parent client area, you're goin got have to supply your own code for placing the child windows with reguard to it's size.
RageInTheMachine9532
|
|
|
|
|
Urg! Pain in the neck... Let's code!
|
|
|
|
|
What? You want Microsoft to do everything for you, just the way you want it?
That's why we write code! We want it done OUR way!!
RageInTheMachine9532
|
|
|
|
|
We want it our way, but we also want some free time to chill out and watch tv
|
|
|
|
|
I'm having a problem with using the Web Browser ActiveX control in a C# windows form app. The circumstance is easily reproducable:
Create the boiler plate example of this using the VS toolbox to create the ActiveX wrapper and add then drag it into your C# form.
Now, open up a web page with your forms app. For instance, mail.yahoo.com. Click in the user name entry field so that focus is there. Now minimize your form app and then bring it right back up. All of a sudden that entry field no longer has the focus.
I have another example using this control through a VC++ 6 MFC SDI app and ironically, it works fine there (the entry field still has focus).
Any ideas on what to look at? I thought it might have to do with message routing differences between windows forms and MFC SDI but hooking the app up to Spy++ didn't reveal anything. Now I'm thinking it's a problem with the .NET generated wrapper but I'm at a loss as to what to do about it.
???
any help appreciated!
|
|
|
|
|
I'm wanting to create a ToolBarMenu with a few combo boxes... I'm having problems on figuring this out.
Does anyone have any sample code to do this? (for .Net Framwork 1.1)
|
|
|
|
|
I have multiple projects in a solution and I am trying to create dependencied, but when i was trying to add a project reference i got the following message:
A reference to NDMUI could not be added. An assembly must have a "dll" extension in order to be referenced.
I do not not how to resolve it......may someone please help!
Tryin' my best
|
|
|
|
|
VS.NET doesn't let you reference a .exe. It is possible, but you'll have to use the command line compiler (csc.exe) or a build tool like NAnt[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I figure that to draw my little windows style borders, i need to actualy have a valid handle to the grahics device for the control.
Now, I have this section of code i have included in my component constructor that causes a problem:
Graphics clientDC = this.CreateGraphics(); <br />
IntPtr hdc = clientDC.GetHdc(); <br />
pDC = ThemeAPI.CreateCompatibleDC(hdc);<br />
clientDC.Dispose();
That throws the following error on run time:
An unhandled exception of type 'System.InvalidOperationException' occurred in system.drawing.dll
Additional information: The object is currently in use elsewhere.
Now, i know it's caused by the existence of the ClientDC, but i'm not sure how to go about solving this one.
I need to get the creatgraphics for the component in question, but I guess, as i'm creating three duplicate components at initialisation, it's running three seperate threads at once, and it's not liking the use of the Device Context. If i don't dispose of it, the program runs for a while before crashing.
Should I construct a graphics handle in the parent form?
Cata
|
|
|
|
|
Call clientDC.ReleaseHdc(pDC) when you're done with the HDC , then dispose your Graphics object.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Okey dokey, works now.
I was trying to use P/Invoke DeleteDC(pDC). It clearly wasn't happy with that.
But i've still got nothing drawn on my background. I think i have the object values right, and i've tried a number of values for iState. So i'm not entirely sure why nothing is appearing. Here is the code
<br />
pTHEME = ThemeAPI.OpenThemeData(this.Handle,"Window");<br />
<br />
Graphics clientDC = this.CreateGraphics(); <br />
IntPtr hdc = clientDC.GetHdc(); <br />
pDC = ThemeAPI.CreateCompatibleDC(hdc);<br />
<br />
ThemeAPI.Rect rect = new ThemeAPI.Rect();<br />
rect.left = this.Location.X;<br />
rect.top = this.Location.Y;<br />
rect.right = this.Location.X + this.Size.Width;<br />
rect.bottom = this.Location.Y + this.Size.Height;<br />
<br />
int result;<br />
result = ThemeAPI.DrawThemeBackground(pTHEME,pDC,5,1,ref rect,IntPtr.Zero);<br />
result = ThemeAPI.DrawThemeBackground(pTHEME,pDC,7,1,ref rect,IntPtr.Zero);<br />
result = ThemeAPI.DrawThemeBackground(pTHEME,pDC,8,1,ref rect,IntPtr.Zero);<br />
result = ThemeAPI.DrawThemeBackground(pTHEME,pDC,9,1,ref rect,IntPtr.Zero);<br />
<br />
clientDC.ReleaseHdc(pDC);<br />
clientDC.Dispose();
What do you make of it?
|
|
|
|
|
Deleting the HDC that way is fine if you don't use Graphics.GetHdc to get it. The reason is that the unmanaged pointer that the Graphics references needs to be freed, otherwise the Graphics object will complain about having an invalid handle when the Graphics.Dispose method tried to delete it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You get that error when the application is not loaded into an STA (single-threaded apartment). Make sure you use the STAThreadAttribute on your entry point and that any controls in your library used in an application are created in the main thread.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Too late m8!
Got to that one on my own
|
|
|
|
|
there are lots of examples on how to set up child form from the MainMDI but i cant find anything on how to open a form from another child form and setting the MDIParent so as it becomes child form, where am i going wrong???
|
|
|
|
|
So long as you're not talking about an MDI child form within another MDI child form (which isn't supported in the .NET FCL), you can simply get the parent MDI form of the first child and add the new child as an MDI child of the parent:
MDIChildForm child = new MDIChildForm();
if (MdiParent != null)
MdiParent.AddOwnedForm(child);
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
fantastic response and worked first time.
|
|
|
|
|
How can i make a panel that can receive a focus
I used the GotFocus and LostFocus events to turn the panel blue when focussed. But how can i set the CanReceiveFocus Property true so that you can use your keyboard (Tab and arrows) to give that control the focus. (That panel also conatains a picturebox and a label).
Thanks
Jonathan Slenders
|
|
|
|
|
Extend the control and in your constructor call SetStyle(ControlStyles.Selectable, true) .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Hello,
May I know how I can create a 2 dimension textbox array? I know how to create a 1 dimension textbox array, but I am having trouble trying the 2D. Thank you!!
|
|
|
|