winforms

Where does A SQLite Database go for a winforms application?

I am trying to use SQLite for a winforms application, what I can't figure out is where to put the datafile in the code, and what my connection string should be. Right now i have added an "App_Code" directory to my may project, and placed my datafile in that directory. I am getting an error that SQLite cannot find the table that does ex...

Inactive control background color

Is there a way on Windows to retrieve the color used as background color for inactive controls (TextBox, etc.)? Or better yet, the border color too? This is for Windows Forms and I haven't been able to find anything suitable in SystemColors. There is no such thing Case in point. I have a text box which may not be large enough for the ...

How to skip Validating after clicking on a Form's Cancel button.

I use C#. I have a Windows Form with an edit box and a Cancel button. The edit box has code in validating event. The code is executed every time the edit box loses focus. When I click on the Cancel button I just want to close the form. I don't want any validation for the edit box to be executed. How can this be accomplished? Here is an ...

Emulating animation with panels on .Net Compact Framework.

Hello! I'm developing a Windows Mobile 5.0 or above with .Net Compact Framewor 2.0 SP2 and C#. I'm trying to "animate" five panels changing their locations on a Timer_Tick event but these panels move very bad. They move like jumping. What I'm doing wrong? Thank you. ...

Need help trying to figure out to grab a column of data

Hi I have something that looks like this H1 H2 CHK1 N1 D1 CHK2 N2 D2 CHK3 N3 D3 CHKN NN DN 1 2 3 4 5 6 7 8 9 10 11 // control positions if you had a counter counting with the foreach loop. So H1 & H2 are just some labels, Chk is checkboxes and N & D a...

Emulating Windows Photo Viewer image dragging in c#

Hi, i'm trying to emulate how image is being dragged inside the windows photo viewer when it is large. The problem is, i don't how to drag the image while keeping it intact in the form's edges. If you're observing windows photo viewer, when you drag the image downward for instance the image moves and stops when the top end of the image i...

Winforms - reference an updatable configuration file

I plan to build a WinForms application that will contain among other controls a dropdown list containing the names of the servers my team supports. I'm looking to the future and wondering what to do if we inherit more servers. Can I create an updatable xml file and distribute that with the app and have my teammates update it when we...

Adding records when binding a datagrid to a list of objects in a winforms app

I have the following classes: public class MyItems : List<MyItem> { ... } public class MyItem { ... } I've instantiated MyItems and assigned it to the DataSource property of a WinForms datagrid. Everything displays properly, but when I try to add rows, nothing happens. What I do is case the grids DataSource back to MyItems, add an ...

SuspendLayout Keep giving me an expection

Hi I am trying to make a windows mobile application and for some reason the SuspendLayout keeps crashing. How it is crashing is this. I go to my login page for my app. I then rotate the phone to landscape and login. I then press the "OK" button that should close this new form I went to. I then am back to the the login page and I rotat...

HTML Agility Pack

Hi All I'm trying to use HTML Agility Pack to get the description text from inside the: <meta name="description" content="**this is the text i want to extract and store in a string**" /> And someone on Stackoverflow a little while ago suggested I use HTMLAgilityPack. But I don't know how to use it, and the documentation for it that I...

WinForm control to list files in a directory

I'm new to the WinForms control toolbox, so I'm looking to get suggestions on which control I should use for the following simple situation: I want to have an area on my form that shows a list of the files in a particular directory. My first quick and dirty inclination is to put a textbox on the form and populate it line-by-line usi...

Seeing new properties on a custom UserControl in Visual Studio

I have two C# .NET projects in my solution. One project is a DLL that contains a WinForms custom UserControl. The other project is a WinForms EXE that references and uses that UserControl on a Form. I have added a handful of properties to the UserControl so that when I place the control on a form I can easily set these properties in t...

C# want to restrict where a form can be moved to.

I am trying to restrict where a form can be moved to on the desktop. Basically I don't want them to be able to move the form off the desktop. I found a bunch of SetBounds functions but they seem to do something that seems very odd to me for the names of the functions and aren't serving my purpose. ...

Textbox related Question: Validating Like it was a DatagridView Cell

Hello... I need to validate a textbox as follows: When the user changes focus from that textbox, I want to show the properly formated currency value, but without lost the real user-entered value, Because i need it for later Calculations, and if is the case, for later editing from the user... Can i do that? i don't want to have another...

enter key should save and close and escape key should close without save

In vb dot net, Windows form details should save if I press enter key should save and close and escape key should close without save Currently it happens on onclick event of a button of Save and Cancel, but I wish the keyboard events also work Any quick code to do that is appreciated ...

Weird behaviour of FileStream in WinForms

I have a WinForms application that checks for a TXT file in the application directory. There will be only a single line (user's email) or none. the code is like this: public static string GetUserEmail() { string path = Application.StartupPath + "\\mail.txt"; MessageBox.Show(path); string adres = String.Empty; ...

disable the default Enter/Return key behavior in a datagridview

In vb.net datagridview the default Enter/Return key behavior is to move to the next row is there a quick and easy way to avoid that. Any suggestions are welcome ...

FileStream seems to find an unexisting file

I have this code: public static string GetUserEmail() { string path = Application.StartupPath + "\\mail.txt"; MessageBox.Show(path); string adres = String.Empty; if (File.Exists(path)) { using (StreamReader sr = new StreamReader(path)) { adres = sr.ReadLine(); } } else { ...

WinForms - Whats wrong with this Focus Set?

I have TextBox placed on a UserControl on a Panel which is placed in a Form. But couldn't set focus by this code, mytxtBox.Focus(); ActiveControl = mytxtBox; mytxtBox.Select(); Why its not working? How to set focus here? ...

QuickWatch-like control for .NET WinForms?

Visual Studio QuickWatch window has a hierarchical property grid control. Is a control like that available somewhere? The default property grid control doesn't seem to work for me as it requires the objects to have an ExpandableConverter attribute to work the way I want. Although, if any of you know a way to turn the property grid into ...