winforms

Does Speech Recognition using .NET Framework require a message pump?

I'm writing a plugin (dll file), and I'm creating a WinForm as its interface/dialog. If it does require a message pump, how and where should I create one? ...

Form constructor vs Form_Load

Whats the difference between a form constructor and the form_Load method? Whats your though process for placing items in one vs the other? ...

Adding items to the Windows control box

Is there anyway to add an item to the control box (wheres the close, minimize and maximize buttons are) with my custom icon in C#? Thanks. ...

How to run two WebBrowser instances on the same PC with different users

I am using WebBrowser Control in the WinForms application (C#). I want to write program which can put Login and Password for some user and test some functionality. It's working fine when I am running one Application instance, but I have problem when I am trying to run two app copies with different users - both instances are working with ...

C#: how do I subtract two dates?

Here's my code: DateTime date1 = new DateTime(byear, bmonth, bday, 0, 0, 0); DateTime datenow = DateTime.Now; DateTime date2 = datenow - date1 On the last line I am getting this error: Error 1 Cannot implicitly convert type 'System.TimeSpan' to 'System.DateTime' How do I subtract two dates? ...

Am I Leaking ADO.NET Connections?

Here is an example of my code in a DAL. All calls to the database's Stored Procedures are structured this way, and there is no in-line SQL. Friend Shared Function Save(ByVal s As MyClass) As Boolean Dim cn As SqlClient.SqlConnection = Dal.Connections.MyAppConnection Dim cmd As New SqlClient.SqlCommand Try cmd.Conne...

Unable to copy a file from obj\Debug to bin\Debug

I have a project in C# and I get this error every time I try to compile the project : (Unable to copy file "obj\Debug\Project1.exe" to "bin\Debug\Project1.exe". The process cannot access the file 'bin\Debug\Project1.exe' because it is being used by another process.), so I have to close the process from the task manager. my project is on...

How do I get the C# Winforms Webbrowser control to show PDF content embedded in the html file as binary content?

I am using a Winforms webbrowser control to display HTML content stored in my SQL DB table. However, some of my contents are PDFs which I intend to store as binary data in the SQL DB and feed to the Webbrowser control. I wish to avoid the hassle of storing the binary content in a temporary file on the client machine and then create html ...

Winform .Net 3.5 - Get path of ApplicationFolder for Office Add-In

I am writing an add-in for Expression Web 3 in VS2008 The solution has a Windows Installer setup project in which the ApplicationFolder is tagged to hold some ancillary files. I need to be able to access those files during the add-in's startup, but naturally the Application object as well as the AppDomain reference paths to Expression ...

How to dispose of variables in windows close button

Hi, I have a windows forms application, where I have declared some static variables. On the click of exit button, I have disposed of some datatable which i have declared static. Many a times the user instead of clicking the exit button, will just exit the windows application by clicking the X button on the left corner top. What should...

Associating keys to buttons on a Windows Form

I have to write a method on C# that associates a certain key (from the keyboard) to a specific button. For example, if I press A, the button that I created on a form application should appear like it is being pressed. ...

Windows Forms open and save default directories

I'm editing someone else's code that uses Windows Forms: SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.InitialDirectory = LevelEditorConstants.PATH_TO_DATA_DIR; Somehow, the directory that opens is totally different than the constant value that is assigned to it. How else can this value be set? A text search f...

How do I paste richtext into a textbox?

I want to highlight some stuff on a web page and be able to paste it into a richtextbox in C# winforms. I want to then be able to see the HTML code of what I had pasted. Is this possible? ...

Why doesn't SAPI's ISpNotifySource::SetNotifyWindowMessage() send the notification to my WndProc()?

I'm using WinForms, and I'm trying to get SetNotifyWindowMessage() to send a message to the WndProc, but it does not do so. The function call: HRESULT initSAPI(HWND hWnd) { ... if(FAILED( g_cpRecoCtxt->SetNotifyWindowMessage( hWnd, WM_RECOEVENT, 0, 0 ))) MessageBoxW(hWnd, L"Error sending window message", L"SAPI Initialization E...

Winforms / .Net - dynamically creating install .exe or script

Hello -- Does anyone know how I can Dynamically create an installation package that installs files into a folder that is determined at installation-runtime, not by the user, but by obtaining the UserAppDataPath for that specific user on that specific PC. By dynamically I mean that I must create the installation package programatically ...

FIFO Mechanism in RichTextBox

Is there an Easy way to implement FIFO in RichTextBox control? Actually i have a testing tool that produce more than 1000 lines within a minute that is why i want to limit the total number lines and when a new line adds in the control the Last line should be removed. ...

Neither Invalidate() nor Refresh() invokes OnPaint()

I'm trying to get from Line #1 to Line #2 in the below code: using System; using System.Windows.Forms; namespace MyNameSpace { internal class MyTextBox : System.Windows.Forms.TextBox { protected override void OnEnabledChanged(EventArgs e) { base.OnEnabledChanged(e); In...

C# how to show html contents with richtext box in winforms

I want to show html contents in my form. I tried to it with rich text box. rtBox.Text = body; but it fails. How to show html contents in rich text box..?? Note: i am using VS-2008 2.0 ...

Firefox-Addon Dialog-like in WinForms?

Does anybody know how to make a dialog that looks a bit like the firefox-addon dialog. especially the list/gridview style... I'm using WinForms with C# ...

DataGridView selectedRow Property not get Data if i double click Row?

i click double dataGridView's any row. Not get Data clicked row data: private void gwStudies_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { GoruntuyuAc(); } private void GoruntuyuAc() { olduid = ""; DataRowView ro = (gwStudies.SelectedRows[0].DataBoundItem a...