winforms

Control.Invoke fails at second call.

Hello! I'm developing a Windows Mobile 5.0 and above application with .Net Compact Framework 2.0 SP2 and C#. I have this code inside a method: if (listBox1.InvokeRequired) { Invoke(new MethodInvoker( delegate() { listaBox1 = listaBox2; listBox1.Visible = true; })); } else { listBox1 = listBox2; listBox1.Visible = t...

Find DataGridView item (row) by Tag

Hi I have DataGridView control that I manyally fill with items (no DataSource) like that int row = dgvClients.Rows.Add(); dgvClients.Rows[row].Cells["ClientObjectID"].Value = somevalue1; dgvClients.Rows[row].Cells["ClientCode"].Value = somevalue2; dgvClients.Rows[row].Tag = SomeObject1; Pls note that e...

How do I get a DataRow from a row in a DataGridView

I'm using a databound WinForms DataGridView; how do I go from a user selected row in the DGV to the DataRow of the DataTable that is its source? ...

Drag and Drop between 2 list boxes.

Trying to implement drag and drop between 2 listboxes and all examples I've seen so far don't really smell good. Can someone point me to or show me a good implementation? ...

C# WaitCursor while form loads

Hello all, I'm having a form that takes a few seconds to finally display. This form is called through: using (ResultsForm frm = new ResultsForm()) { this.Visible = false; frm.ShowDialog(); this.Visible = true; } It's useful that I get the default cursor to Cursors.WaitCursor while waiting for the form to finally display. ...

C# Forms application getting stuck On Top

Hey all, real strange one here. I have a c# 3.5 forms app running on Server 2008 R2. The application is MDI, with about 15 active forms on the screen at a time. Periodically, I get into a situation where the application is "Stuck" on top, that is to say that I can't alt+tab to any other form, the task bar appears, but the other form...

C# Printing Inconsistent

I have a form on which I have a number of textboxes. I wish to print the text from these textboxes in the locations they are on the form. It is printing at the moment using the code below. However, the text prints differently on different printers (on some it prints just right, on some too high, etc). It is being printed on a pre-printed...

Tabcontrol: How can you remove the tabpage title?

I have a tabcontrol used to display multiple image files in an application. I would like to remove the tabpage title when there is only one tabpage displayed, so I can use that screen space for the image. (This is similar to deselecting "Always show the tab bar" in Firefox.) Is this possible to do with the tabcontrol? Or am I better off...

Windows Forms - Communication problem between Child Forms

The prob statement: - Accessing functions of a child form from another child form within an MDI parent in a windows application(C#).. - Closing a child form (when navigating to a new child form), and invoking a method within the child form, and then navigate to the new form ? Using Infragistics NetAdvantage for Windows Forms ...

Datagridview, contextmenu of rowtemplate doesn't show submenu's

In a windows form using vb.net 2008 a context menu when mapped to the datagrid shows submenu's properly but when mapped to a row template of the same datagrid view does not submenu or dropdown items in that menu Any help on this please ...

DataBind listBox selected item to textboxes

Hi! I have ListBox data bind to list of users (collection): usersListBox.DataSource = null; usersListBox.DataSource = _users; usersListBox.DisplayMember = "Name"; usersListBox.ValueMember = "Id"; Now I want properties of selected item to be shown in different text boxes, so I do the binding: nameTextBox.DataBindings...

Display a file from a byte[] or stream

I've got a winforms app that stores the contents of files in a database. The stored files can be of just about any type (word, excel, PDF, text, image ...) the user can select just about any type of file to load. The user can then query the database, find a file and then open it. I've got no problems extracting the byte array from the ...

writing functional tests for a desktop app in dotnet

Hi, We are developing a desktop application in winforms using 3rd party controls,which are not UI automation compatible.Is there any way to do the functional tests through UI.We want to perform various actions on UI, n assert correct Ui changes are happening and the backend stuff changing(assert db record saved). ...

Create web service consumerprogram for test purposes automatically?

I find that when Im building a lot of webservices I tend to create thousands of small "testprograms" whos only purpose is to test the webservice. Yes, if your webservice only takes integers and strings you can use the built in testpage that the webservice serves up, but often you have booleans, userobjects or strongly typed datasets that...

Should I revive Clippy ? aka how can i provide user-friendly tips and help in a desktop application ?

While I've been working hard to keep the WinForms application I'm working on simple and easy to learn, the functional domain I'm working in (finance) is pretty rich, and I feel I should help the user figure out what to do next once the program is launched. I must add that in the software I'm working on, there's often "something to do ne...

Is an Event running in another thread? (.Net Compact Framework).

Hello! I'm developing a Windows Mobile 5.0 or above with .Net Compact Framework 2.0 SP2 and C#. when I try to access the control's width on a method that handles an event it throws me the following exception: Control.Invoke must be used to interact with controls created on a separate thread. Is this method running in another thread? ...

accessing tabcontrol from myclass.cs

why can't i access the tabcontrol from within myclass.cs? e.g. tabcontrol is on form1.cs and my code that tries to create a new tabpage is in myclass.cs. i've even tried setting tabcontrol property to public but that didnt work thnks :) ...

The old switcheroo (switch position in file)

Hi All, I would really appreciate if somebody could help me/offer advice on this. I have a file, probably about 50000 lines long, these files are generated on a weekly basis. each line is identical in terms of type of content. original file: address^name^notes but i need to perform a switch. i need to be able to switch (on each and...

C#: Synchronize Scroll Position of two RichTextBoxes?

In my application's form, I have two RichTextBox objects. They will both always have the same number of lines of text. I would like to "synchronize" the vertical scrolling between these two, so that when the user changes the vertical scroll position on one, the other scrolls the same amount. How might I go about doing this? ...

XML Deserialization of carriage returns causes unprintable characters

Situation: When I deserialize XML that contains carriage returns, the characters appear as unprintable character "boxes" rather than as carriage returns. Background: User input collected via a multi-line textbox contains carriage returns within the text. I am persisting this text data to XML using the .NET XML serializer (snippet below...