winforms

How Can I Convert the Value - listViewRecs.SelectedItems[0].SubItems[0] - to Integer? - C#.NET

int val = lstvRecordsCus.SelectedItems[0].SubItems[0]; The returned value is an int in a string datatype. I need the right hand side to return the value in int instead of string. I tried Convert.ToInt32, it didn't work. Any idea? All the values that comes from SelectedItems[0].SubItems[0] is of type int. ...

How to Select Multiple Records from Multiple Tables at Once

I have two tables Customer and CustomerPhone. Customer usually has multiple phone numbers, so when i run select statement on customer 101, i will get multiple records due to the multiple phone numbers. As you see below all the "Phone" and "Fax" field belongs to CustomerPhone table. These are considered as two records in the CustomerPh...

Why does my call to Activator.CreateInstance intermittently fail?

I'm using the following code to access the Windows Explorer Shell's band site service: Guid GUID_TrayBandSiteService = new Guid(0xF60AD0A0, 0xE5E1, 0x45cb, 0xB5, 0x1A, 0xE1, 0x5B, 0x9F, 0x8B, 0x29, 0x34); Type shellTrayBandSiteService = Type.GetTypeFromCLSID(GUID_TrayBandSiteService, true); site = Activator.CreateInstance(shellTrayBandS...

How to save a List<string> on Settings.Default ?

I have a ListBox on my Form, I want to save it and load the values when I start the application again. How can I save a list on PrjName.Properties.Settings.Default? ...

Get SubItem value when double-clicking on Item in ListView

Hi All I have a listview with 2 columns, and when the I double click on an item, i need to display the value of its corresponding sub item in a TextBox control. How can I do this? I searched Google, but it didn't return anything helpful, probably because I'm not exactly sure what to search for. Thank you ...

SmtpClient.SendAsync(); Not working on my new (64bit) computer.

Hi All, Okay, Only a couple weeks ago I had an old 32bit computer, but had to buy a new computer, which happens to be 64bit. I've rewritten the method that sends e-mails asynchonously and it just does not work. And does NOT throw any exceptions either. What gives? I have also tried the Async method code found iin MSDN, and the BlackW...

How do I disable webbrowser window in winform app when dialog is shown

I have a winform app with a webbrowser control embedded in the main form using SHDocVw.dll When dialog is shown I need to disable the browser window. The window class is "Internet Explorer_Server". pinvoke EnableWindow() did not work. What else can be done ? ...

How to add a margin to a CheckedListBox in .NET?

I'm writing an windforms application using .NET (actually IronPython, but that's not relevant), and I have a CheckedListBox object in my GUI. It's working fine, it has about 20 items in a multicolumn layout. But I can't figure out how to give the thing a nice internal margin--I want to insert around 20 or 30 pixels of whitespace ar...

how to capture delete key press in C#?

I want to capture delete key press and do nothing when key is pressed. How can I do that in WPF and Winforms? ...

Drag rows out of a multiselect DataGridView

I'm having a problem dragging rows out of a datagridview. The grid has the property multiselect = true and every time I select the rows I want to drag out and then left click on the grid again, the selected rows disappear. Anyone got a solution / a working example? Thx. ...

Business Objects Web Intelligence-style reporting in a Winform app. Is this possible?

I have a WinForm app that displays results in a Gridview control. If a user right mouse clicks on a row, he can then, from a popup menu, select a command to perform on the row much like windows File Explorer. But now I want to be able to give the user the ability to construct a filter so that he can control which rows are displayed in t...

How can I discover the DLL used by a Window of a running .NET WinForms app?

I'd like to find a tool that I can use to point at a specific Window in a large application with many DLLs and discover the path (or at least the name) of the DLL used to render this window. ...

Close box triggers validation for non-modal form

I have two form classes inheriting from a common base. One of the forms is called modally and the other non-modally. Validation is required on focus changes but not when the form is cancelled. When the Close Box is selected on the modal form it closes properly without any validation being triggered on it's controls. When the Close Box is...

Web application vs. web services vs. classic application

Please I need help. I have project in which I need application which communicates with local DB server and simultaneously with central remote DB server to complete some task(read stock quotas from local server create order and then write order to central orders DB,...). So, I don`t know which architecture and technology do this. Web app...

How to create windows form to display properly in all monitors?

I have created a windows form using (vs.net 2008 and vb.net as programming lanugage). Functionality part is working fine as expected. My issues is that, when i run my application in different machines, the form display is not proper accross the monitory screen. In some machines i noticed extra space on leftside of the container. In som...

Am getting un-expected NULL values in a Datagridview's calculated column

I have a Bindingsource that am setting as a datasource to a DataGridView control. In its dataset query i have a calculated column(Column1). When i go to the Bindingsource's tasks and click Preview Data i can, for my Column1 other rows have data values returned and for other rows NULL is returned which is ok and expected. The problem is ...

Sort a DataGridView by DisplayMember

Hi, I have a DataGridView that is bound to a DataTable. In this table there are some foreign keys. I am then using the CellFormatting event to get the corresponding text from another database table for each foreign key. I want to sort the DataGridView when the user clicks the header. Automatic sorting works but is not correct as it is ...

Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug

This is a question asked before, both here on Stack Overflow and other places, but none of the suggestions I've found this far has helped me, so I just have to try asking a new question. Scenario: I have a simple Windows Forms application (C#, .NET 4.0, Visual Studio 2010). It has a couple of base forms that most other forms inherit fro...

How can I get a round button?

I need you to refer me to a good dll file that I can add to my VS in order to have a round button control, any suggestions? ...

File viewer with sliding buffer

Hello, I'd like to make a simple text file viewer and I'd like it to be able to handle large files (possibly larger than the computer's memory). I know that I need to implement something like a sliding buffer, that will contain the currently visible portion of the file. The main problem is to determine the relation between lines and fil...