winforms

Spreading controls to fill space as a dialog resizes

Hello, I have a dialog with column down the right side filled with buttons. The dialog is built with Windows Forms. I have a mockup at the following link:original dialog (I would have included it but apparently i'm not allowed to use image tags) I would like for the buttons in the right column to resize themselves to fill the remaini...

detect ctrl+left click in winforms application

detect ctrl+left click (for button) in winforms application ...

Looking for a .NET C# tip-of-the-day component

Putting aside the discussion of the merits of including a Tip of the Day in an application (a la Is Tip of the Day Good) I am seeking either a ready-to-go library or C# source code for a .NET tip-of-the-day dialog for an open-source project (so I am looking for an open-source component, of course). It is usually easy to locate a needed c...

Data Selection - Linking DataView and DataGrid

Ok, I am creating a standalone C# program. I currenly have the following. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Xml; namespace tmp { public partial class frmPlayerSelect : Form ...

check if value is entered for datetimepicker?

How can I validate that a value has been selected in a datetimepicker control. The control is bound to a bindingnavigater so when the save button is clicked I want to ensure a date has been selected? ...

how to display Value in log file from an xml file

I have an xml file sample.xml located in some folder: <?xml version="1.0"?> <!-- Please Enter your frequency value between 10sec to 80sec --> <Time> <Value>80</Value> </Time> this xml file is given to user if any one enters beyond the limit say 8, or 700 it wl send the default value as 80 in the log file(it is windowservice we don...

How do you refresh a combo box item in-place?

The ComboBox Items collection is an ObjectCollection, so of course you can store anything you want in there, but that means you don't get a Text property like you would with, say, a ListViewItem. The ComboBox displays the items by calling ToString() on each item, or using reflection if the DisplayMember property is set. My ComboBox is i...

Simple Browser Control in C#

I have a simple C# WinForms Crud AP for employees that have to do a lot of simple web lookups. Currently it loads 5 websites and puts a search term into the clipboard. The employee then has to paste the search term into the search textbox on each of the sites and hit enter. Is there a simple way to enter the data for them? The search tex...

IDataErrorInfo with complex types

I have an Address object defined simply as follows: public class Address { public string StreetNumber { get; set; } public string StreetAddress { get; set; } public string City { get; set; } public string PostalCode { get; set; } } Fairly simple. On the advice an answer to another question I asked, I am referring to th...

PropertyGrid - Custom property names?

I feel like an idiot for being stumped by this, I feel like the answer must be obvious. But, alas, after spending too much time looking through the Object Browser and Googling, I come looking for help. I have a class that I use in a PropertyGrid. I found that by setting CategoryAttribute on each property it creates a new category for ea...

PropertyGrid - Dynamically changing ReadOnlyAttribute

Sigh, another PropertyGrid question. I thought I could get around this until I ran into a problem where I couldn't actually avoid it. I have a boolean property that sometimes needs to be read-only and sometimes needs to be changeable depending on the object selected from a TreeView. My question is how can I change the ReadOnlyAttribute...

How do I access a file share programattically

I have a windows forms app running on a machine that is not on a domain, that needs to be able to move a file from the local filesystem to a UNC path. I have a username and password for that path. I was wondering is there any way to do this directly with out execing the net.exe command? Ideally I wouldn't have to map a drive. ...

C# Navigate to Anchors in WebBrowser control

We have a web browser in our Winforms app to nicely display history of a selected item rendered by xslt. The xslt is writing out <a> tags in the outputted html to allow the webBrowser control to navigate to the selected history entry. As we are not 'navigating' to the html in the strict web sense, rather setting the html by the Docume...

How is coordination of child views best handled in MVP?

I am attempting to use MVP in WinForms and am confused on how to best handle coordination among child views. For example, I have a parent view that has two child views. Events on one child view need to cause an action to be taken by the second child view. Should the parent view control this directly? It seems like I am bypassing the M...

C# | How Do I Select a Word in a TextBox by Cursor Location?

In a Windows Form, using C#, how do I select (as in, actually highlight the text, making it accessible to the .SelectedText property) a word based on the cursor location? Here's what I'm trying to do. I have a textbox that users can currently select a word by highlighting it. They can then perform various actions to the word, but I want...

Escape character in VB.NET

For displaying the character & in a button as text, i am using && I would like to display the string % in another one button but the &% does not work. So how can i display the char % By using this btn5.Text = "%" the percentage symbol is not displayed at all! ...

TreeNode Right Click Option

Hi, I am working TreeView and TreeView.Nodes in my C# GUI application and want to use the right click functionality on a few nodes in my tree. I have searched quite a bit but it seems like the SelectedNode is valid only for left click and there is nothing to capture the right click on a node. I want to add functionalities like 'Add', 'R...

How can I have selectable labels?

I need to have label like controls which display certain information which can be selected. Which control to use? I need the label (ie control) to be selectable. The form may have several such controls and the information displayed in each is determined by a single drop down selection in the form. ...

Being Able to Debug a WinForms Application and Avoid the GUI from Freezing

UPDATE: I pasted the entire source for Mr. Kraft. Having said that, this is probably my first real WinForms app, so please dissect and critique as well if you feel like it. Also, to make the critiquing less painful for me, I should note that I wrote this app very quickly, so I have a task of refactoring and improving design for it assign...

Programmatically detecting mouse hover over taskbar/window caption (winforms/C#)

I want to find out if the mouse is hovering over a taskbar button, and the caption / hwnd of the window that belongs to the button. E.g. if you move the mouse over a taskbar button, you get the tooltip with the name - so this should be possible fairly easily? ...