winforms

ContextMenuStrip renders at top left Windows

Hi, When i render contextmenustrip, it gets render at the top left of my PC Screen. I have a listview, which contains 5-6 items and on right click of each item, the context Menu strip gets displayed.Also i need to change the color of context menu strip including backgrounds and text as well. Thanks in advance! ...

What's wrong with my C# while loop?

There's something wrong with my while loop (in my Form class), but basically, it tests to see who the winner of the "race" is in my application, and it also starts the application (Shark.Swim). Once it finds out who the winner is, it needs to get to the "payout" method in my Bet Class. So here's what I have. INSTANCE VARIABLES private...

How to save a new record in SortableBindingList

I have a DataGridView connected to a SortableBindingList. db = new eScanEntities(); bs = new BindingSource(); List<Doctor> lDoctor = db.Doctor.OrderBy(o => o.DoctorNo).ToList(); bs.DataSource = new Classes.SortableBindingList<Doctor>(lDoctor); dataGridView1.DataSource = bs; I can edit a record i...

Closing Stream Read and Stream Writer when the form exits

Hey guys, having a bit of trouble here. So I have a load button that loads the file, and a save button the saves the file. I also have a exit button that closes the program. What I need help with is when I close the program, I wont to check whether there are any StreamReader or StreamWriter things that have not been closed. Heres what ...

Environment.Exit() causes my application to crash after using Process.Start

I have a small form that creates two background worker threads which listen for messages from two separate server processes. When the user attempts to close the form, I handle the OnFormClosing event (or they can click an 'Exit menu item) which calls CancelAsync() on both threads. The form then waits until the IsBusy property for both ...

Apply changes to mainforms Form.Icon at runtime

I have a System.Windows.Forms.Form and want to change the Form.Icon at runtime to display a status. I've managed to load the icon from the projects ressources: Type type = this.GetType(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(type.Namespace + ".Properties.Resources", this.GetType().Assembl...

How to create panel like windows in WinForms

Please See this: http://img405.imageshack.us/img405/2008/rolloversummaryschedule.jpg How can i create a window that holds Patient data in it? The 2 records that you see is in List View. I would then using ContextMenuStrip for text "View Details". When View Details is clicked i need to show the context. For web development this could be...

OpenfileDialog - Window is not popping out

Hi, i am working on form . i want small window to pop up when i click button and to will select XML file of my chois from various folder. I guess, this OPenfileDialog will help me. check the code. private void button3_Click(object sender, EventArgs e) { / OpenFileDialog OpenFileDialog1 = new OpenFileDial...

Merging docx files together including headers, footers and pictures

I've to merge multiple DOCX files (created with DocX Package) into one big file. I've managed to merge multiple files already but I fail to merge Headers and Footers (they differ between files, pages). I've tried both DocX package and MS Office COM Interop and it simply doesn't want to merge the headers / footers. They are skipped. Does...

Set DataBindings property for UserControl from VS designer

I've created simple UserContorl(WinForms) that consists of 1 TextBox(Txt) control, also i created property "Txt" that return this control(Txt). Now when i try to set DataBindings for this contorl from the VS designer through Txt property, it failed. i.e. you can set the property, but if you close vs designer and open it again DataBinding...

Hiding winforms app from taskbar

How can I hide a winform, so that it t will not show in the Windows taskbar , user do not see it , or when the user presses Alt + Tab ? ...

How can I tell if the mouse is over a top-level window?

How can I efficiently tell if the mouse is over a top-level window? By "over", I mean that the mouse pointer is within the client rectangle of the top-level window and there is no other top-level window over my window at the location of the mouse pointer. In other words, if the user clicked the event would be sent to my top-level windo...

Winforms: Why do events fire at design-time?

Why are messages displayed at design-time? My code is : class Class1 : TextBox { public Class1() { this.Resize += new EventHandler(Class1_Resize); } void Class1_Resize(object sender, EventArgs e) { MessageBox.Show("Resize"); } } Pic : ...

Multiuser login into winforms application

Hi there, i have a winforms app in C# that needs access control for certain forms. That means, the application is running under the same (default) user at system startup, but certain forms need to be secured, so that only certain windows users could have access to the additional functions after identifying themself with username and pas...

Calling a Winform hosted WCF service from javascript

I have a Winform hosted WCF service with Ajax Web endpoint. I also have an ASP.NET project separately, with ScriptManager component on the page. My question is, should that work if I make service calls to my Winform hosted service from the client side of ASP.NET app using javascript? My ASP.NET Default page looks like this: <scrip...

Combining list boxes into rich text boxes?

Hey all, another homework assignment here thats kind of unclear on the requirements. It is a forms program that assigns people to seats on an airplane. The part that is losing me is that its telling me to display the passenger manifest in a list box, but then its telling me to display it in a list box. Then it calls it a rich text box a...

Passing a value back to original form

I have two forms: Form1 and Form2. I can get the contents of a List in Form1 to another List in Form2 by calling a new Form2 and passing the values in. I update the List in form2 by say, removing an item from it. How would I pass the contents of Form2's list BACK to the original List in Form1? Form1 is the first form that appears when th...

How to reference the current control (the one which has focus generically) in C# winform ?

I'm used to reference the current control in access vba, how to do so in C# winform ? ...

Add Trendline in Windows Form Chart Control

Hi guys, I would like to add a trendline to my windows form chart (from Microsoft Chart Control), I have tried Googling but found most of them is for how to add a trendline to excel, or other 3rd party chart components etc. Can anyone please enlighten, thanks! Regards, Andy. ...

C# MouseClick Event a bit laggy, how can I fix this?

I'm making a craps game, and I have a "Craps Table" image in a PictureBox Control. I've made a MouseClick event handler for the PictureBox to check what region was selected by the user, and add a bet to that "Part of the Craps Table" when clicked. Everything works great, except if I click the region very quickly, the event fires only ...