winforms

progress bar click => change current track play position

Hello! i am making a music player in winforms. i have a progress bar and when i click on a position along the progress bar, i want to get the int for that position ( from 1 to 100 , i.e. for when i want to get to a certain point in my song ) . How can i do that ? Regards, Alexandru Badescu ...

How do I create an "unfocusable" form in C#?

I'm looking to create a form in C# that cannot accept focus, i.e. when I click a button on the form, focus is not stolen from the application that currently has the focus. See the Windows on-screen keyboard for an example of this. Note that when you click a button, the focus is not taken from the application you're currently using. How...

winform report populate only textboxes

Hi Everyone- I am trying to recreate a current MS Access report in a new Winforms application. I am using the Microsoft Report functionality in Visual Studio. The report is really basic. It really is just a fax coversheet with data about one record in a table of data. So all I need to do it populate textboxes on the report with the...

Why SomethingCollection is used instead of Collection<Something>?

Hi, In .NET Framework, there are some classes which use SomethingCollection syntax. For example, when dealing with SqlCommand, it has a parameter Parameters of type SqlParameterCollection. Since it does not have a form of IEnumerable<SqlParameter> (or IList<SqlParameter> or something similar), it is impossible to write: foreach (var c...

Is it possible to implement WPF in already developed C# Windows form application Without Changing Existing code?

i am working with C# windows form application i developed project in that.i like to make project design into more stylish and modern.is it possible to do like this by using WPF,if yes i like to apply WPF code without change Existing code and design,Is it possible to do like this. For Example i am putting one button name OK if i click OK...

Getting handle of Autocomplete dropdown box of textbox in winforms

I wanted to adjust the width of the Autocomplete dropdown box of a textbox. I dont want to adjust the width of that textbox, but only Autocomplete dropdown. I know that there is no way I can increase the width of the Autocomplete dropdown by using properties provided with textbox. Hence I wanted to know whether there is any way to get t...

Inconsistent empty (blank, white) lines (area, rows) on top of listview in virtual mode

Helllo. I have application with some listviews that are configured to virtual-mode. On several computers I've seen strange phenomenon: somtimes there are white row[s] (one or more) above all items. Apperantly it happens when there are insufficent items for showing vertical scrollbar. It's inconsistent: on some computers it shows one, at ...

how to run from button1 to button5 in my form ?

hi i have 5 button's and 3 textbox in my form (WinForm) i need to run from button1 to button5 and change the text to "aa" for example how to do it ? (in C# code) thank's in advance ...

COMException (0x80040154): Class not registered when using AxAcroPDFLib

I am getting following error when using AxAcroPDF System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) The line which throws error is ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).EndInit(); If anyone knows the solution please h...

Adding and removing ToolStripMenuItem's from MenuStrip and DropDownItems in WinForms

I have MenuStrip with some static items. To this MenuStrip I am adding items programmatically. Some of these items has child items (DropDownItems). At some point I would like to remove all added items to recreate menu with different items. How to do it right? Example situation: mainMenu -staticItem1 -added1 -added1_sub1 -added1...

Display tooltip for items in combobox in C# winforms

I am trying to display tooltip for items in combobox. I tried this code in combobox selected index changed event but it does not work as expected. ToolTip toolTip1 = new ToolTip(); toolTip1.AutoPopDelay = 5; toolTip1.InitialDelay = 0; toolTip1.ReshowDelay = 0; toolTip1.ShowAlways = true; for (int i = 0; i < cbo.Items.Count; i++) { too...

WIndows GUI automation on minimized window

Hello, As a disclaimer I am not at all familiar with Win32 development. I was wondering if there was any way to automate control input to a GUI application if that application is minimized. Most automation tools I have seen specifically use coordinate offsets from the window (tlx,tly). I don't need a testing framework, I simply want ...

Trouble with saving a combobox value with Entity Framework.

This question is pretty simple, but I'm not seeing why the code isn't working? Here's how I set the members of a ComboBox I have on my form: private void LoadUsersToComboBox() { ScansEntities3 db = new ScansEntities3(); comboBox1.DataSource = db.People; comboBox1.DisplayMember = "Name"; comboBox1.ValueMember = "ID"; } ...

Form does not restore to previous size after minimize all

The form is set up to have no maximize button. When Win+D is pressed, all windows minimize including the form. When clicking on the application's taskbar entry, the form shows up but does not restore to the previous size. The form is reduced to just showing the title bar and the borders, w/o the client area. I tried listening for WM_SIZ...

Best practice for visual validation of textbox control data

I think I want to show some kind of confirmation tick type thing by a textbox - (it's traditional windows forms stuff, not WPF) - but not sure if it's a bit naff. I would like some kind of slick way of showing that a value is incorrect or valid after some tests have been done i.e. a web service is valid with that name or SMTP server see...

Select Tab Page in TabControl without stealing focus

Using TabControl.SelectTab("...") shows the tab but it also gives the tab focus. I would like to show a particular tab, but keep focus where it is. I have data rows in a grid. Based on properties of the selected row, I show a different tab page to have a different UI layout. But when using arrow keys to scroll through rows, the focus...

How to ignore a checkbox change in listview?

Hi, I have a listview with a the property checkbox = true. When the user clicks on the checkbox and changes its state (checked -> unchecked or unchecked -> checked), I catch the ItemCheck event and do some DB implementation. I want to ask the user for confirmation before working with the DB. When I the user cancel it's command, I wan...

Custom WinForms Control -> Serialization

I've written a small framework. Then I've written a new WinForms control, which hosts my one framework, and a designer. Now my problem: The host control has a property of a class type. Whatever I try: The property is lost at runtime. Could someone explain me, what attributes I need? ...

What does the parameter formattingEnabled do in Binding's constructor?

Here's the documentation. I haven't found any explanation anywhere. There is a data binding overview but is for WPF, and I'm using WinForms. I thought what it does is to call whatever method I assign to the event Format of the Binding class, but it will call it even if I set formattingEnabled to false as long as I assign a method. So now...

What's wrong with this code?

public partial class Form1 : Form { MyClass myClass = new MyClass("one", "two"); public Form1() { InitializeComponent(); textBox1.DataBindings.Add("Text", myClass, "Text1", false, DataSourceUpdateMode.Never); textBox2.DataBindings.Add("Text", myClass, "Text2", false, DataSourceUpdateMode.Never); }...