Questions tagged [winforms]

34404 questions
0

votes
0

answer
5

Views

how to find mail that was send by MailItem.Display()

I have following requirement : Allow the user to drag & drop an email from outlook to a datagrid Prepare a reply mail, and show it so the user can review and send After sending, also fetch the send mail and put it into the datagrid The drag/drop I have working Preparing the replay email and showing...
GuidoG
0

votes
0

answer
22

Views

Unable to pass null parameter in winform's event handler?

i want to subsequently apply filters to my search Say ' if I give 10K as the myFee value it should show all subjects with 10K Fees however if after this I give year 2014 it should show results applying both fee and year constraint simultaneously currently, I am getting a correct result if I give va...
Chameleon
1

votes
2

answer
1.7k

Views

c# winforms communication between user controls

I'm new to the whole winforms programming. In the beginning, it seemed like all the code was ending up I'm the main form class. So i searched up how you're meant to organize code in winforms apps. One solution I am trying right now is separate parts of the interface into user controls. The problem...
terryhau
1

votes
3

answer
2.2k

Views

How to show only a substring of an item in a ComboBox in C#

I have some Company names as Items in a ComboBox like this: 123 SomeCompany Always a number between 100 and 999 plus the company name. Now if the user selects an Item I want the TextBox to only show the number, not the company name. he company name should only be visible when he drops down the Comb...
asdasdad
1

votes
3

answer
6.1k

Views

ComboBox.SelectedValue throws null reference exception

I've put together the following code to demonstrate a problem I'm having. It's a form with just a combobox, which is populated using an array generated from LINQ in the load method. It's got DisplayMember and ValueMember set. Display member works as expected - it displays a list of numbers. Howev...
RoadieRich
-1

votes
0

answer
21

Views

How to Identify when Taskbar setting “Automatically hide the taskbar in desktop mode” is set to On

I have a custom Form and a custom control, now I am facing with some problem with the control size when I turn on the setting 'Automatically hide the taskbar in desktop mode' to true. How can i get the value whether this property is enabled or whether the TaskBar has been hidden or visible. I have c...
nikhilesh olety
0

votes
1

answer
57

Views

Application freezes when I open a file dialog

I want it so that when the user clicks on the button and opens an image, the image gets copied to another location and the filepath of the copied image is saved inside 'Properties.Settings.Default.custombgfilepath' Here is my code: private void Button2_Click(object sender, EventArgs e) { //check for...
Apollo199999999
1

votes
3

answer
2.4k

Views

To make a specific line from a set of lines bold in a textbox/listbox

I need to make a specific line in textbox/listbox bold in C# . net and not the entire box contents ok. Below is the example, consider that these all are displayed in text/list box, Hi Hello How are you You could note that hello is bolded, this is what I need to achieve. Kindly help me to achieve th...
Raja Vignesh
1

votes
1

answer
2.8k

Views

How do I properly select a row in ObjectListView?

I'm using ObjectListView with C# and .Net 4.0. I wrote code that reloads the listview and then re-selects the last selected index. The re-selection code is quite simple: olvListView.SelectedIndex = i; This appears to work, because the item is selected. However, if I then click the up or down arrow,...
user884248
1

votes
2

answer
2.7k

Views

How to make a vertical separator in a Windows Forms Application (C#)

For a project, I have to make a Windows Forms Application that makes a Mandelbrotfigure. Now i want to add a vertical separator between the UI on the left and the Figure on the right (See Picture). Any idea on how to do that?
Boris Winter
-1

votes
2

answer
22

Views

how do i set the status bar from a static [duplicate]

This question already has an answer here: Async Progress Bar Update 3 answers I have a form (called Form1) and I have created a status strip (called toolStripProgressBar1), with a label and a progress bar. I have a function that is called when you press a button and gets some data and processes it,...
StuartAM
0

votes
2

answer
16

Views

Creating a XML file from a database with a model C#

So I need to create a method that makes an XML file from a database, I have already written the stored procedures that get the information from a database for the XML now I only need to write the part where I convert my database to a XML file using the properties of another class that I have written...
Uros Dimitrijevic
-3

votes
0

answer
25

Views

Show updates from Vending Machine on other forms [on hold]

I made vending machine. In this code, I want to click form1 button4 then show sales volume of vending machine in form2.label1: 'this sales volume have to accumulate when i buy in vending machine' and 'this sales volume show in form2 label1' in this code i want to do when i click form1 button4 then...
hahahahah
1

votes
2

answer
75

Views

Why is the combobox doubling its items when being created?

I'm creating a combobox programmatically as follows: var cbo = new ComboBox(); cbo.HandleCreated += (s, e) => { cbo.DataSource = mylist; }; When I do the above, the combobox displays double the items contained in the list. However, when I do the following, the combobox displays the correct number of...
Ivan-Mark Debono
1

votes
4

answer
74

Views

winforms - show same form twice?

I have a quick and dirty winforms app I wrote, Which has a lot of controls logic & internal logic written within the Form() class. I have a need to just open the same form twice (Where one form will be like a reference to other), and I'm looking for another quick and dirty solution. That the code wi...
Y.S
1

votes
4

answer
110

Views

How to send “{}” in SendKeys

I am trying to send '{' and '}' using SendKeys.Send() I already tried to use string.Replace{'{', '{{}'} txt = txt.Replace('{', '{{}'); txt = txt.Replace('}', '{}}'); SendKeys.Send(txt); I expected it to send '{' and '}' but the Program throws an error System.FormatException
PikaFan123
1

votes
2

answer
58

Views

Factorial calculator presenting a negative number that should be positive. How to Fix?

I need to code a factorial calculator that goes as high as 20! I get to 19 and it's fine, but when I try to calculate 20! it returns a negative number. How can I fix this? Now, a bit of background (in case what I have is completely incorrect) I did not take the VB.Net class (where they learned fa...
Amanda
1

votes
1

answer
58

Views

Is there a way to set the period of time that the mouse must be over a control in order to trigger its MouseHover event?

I need a way to set the MouseHoverTime Property, or some other way of making it so that the mouse needs to be over a control for a given amount of time before an event kicks in. I have a set of controls that need to execute code when the mouse passes onto them, which can be done with either MouseEnt...
Gondola
1

votes
2

answer
75

Views

Changing from AnyCPU to x86 causes System.BadImageFormatException error

I have created a WinForms UserControl. When I leave the platform at AnyCPU, I can debug it without any problem: When I press Play, the preview comes up. Then I try to change the project to x86. Therefore I click 'AnyCPU', then 'Configuration Manager'. At 'Active project platform', I select 'New...'....
tmighty
1

votes
2

answer
26

Views

Getting the state of TreeList after Refreshing its DataSource?

I have a DevExpress Treelist, its DataSource is a list of objects. I add new items to the list and then I refresh the Treelist DataSource using this piece of code treelist1.RefreshDataSource(); After refreshing all expanded and selected nodes will collapse and it is annoying. How can I get the state...
mohammad almasi
1

votes
4

answer
654

Views

Multiple FileSystemWatchers a good idea?

I'm writing a mini editor component that is much like Notepad++ or UltraEdit that needs to monitor the files the users open - its a bit slimy, but thats the way it needs to be. Is it wise to use multiple instances of FileSystemWatcher to monitor the open files - again like Notepad++ or UltraEdit or...
1

votes
3

answer
1.7k

Views

Implementing an OpenFileDialog with sound file preview

I would like to implement an open file dialog or file browser that additionally offers a 'Preview' button to play the currently selected sound file (wave format in particular, other formats are not necessary for this application). I could create my own form with various controls such as a treeview a...
JYelton
1

votes
2

answer
12k

Views

C# MySql query result to combobox

I'm trying to query an MySql table, put all results into a combobox. So my query results in apple 2220 I want to populate the combobox with apple2220 i'm having trouble getting the string outside of datarow. string MyConString = 'SERVER=localhost;' + 'DATABASE=iie;' + 'UID=root;' + 'PASSWORD=xxxx;...
-1

votes
1

answer
87

Views

Embed Selenium initiated chrome browser in winform

I have build a c# Windows Form application which required both automation and human interaction on the Chrome browser opened by selenium. Currently 3 separate windows open 1. My Winform application 2. Selenium Console 3. The Chrome browser I would like to embed both the console (will embed but hide...
Siddharth Chabra
1

votes
1

answer
6.3k

Views

save word document that's been created dynamically using SaveFileDialog?

I have code that writes text to a Word document (non-XML) and saves it to a file. Now, I'm trying to modify it so that the document is created and the user is then prompted to save the document. This is the code for creating the Word document: object miss = System.Reflection.Missing.Value; object Vi...
1

votes
1

answer
2.2k

Views

How resize Tab control programmatically?

I want programmatically resize tab Control on my winform. tabCtrl.Size.Width = Convert.ToInt32(numericUpDown1.Value); tabCtrl.Size.Height= Convert.ToInt32(numericUpDown2.Value); But I get error: Cannot modify the return value of 'System.Windows.Forms.Control.Size' because it is not a variable Any id...
Michael
1

votes
1

answer
1.8k

Views

How to send HTML email with multiple Images

i want to send html mail with multiple images. i am using webbrowsercontrol to embedded multiple images but when i send mail HTML email along with Image in HTML then I receive only html mail without Image.!
Sumit Goyal
3

votes
1

answer
140

Views

How to show report data in center of RDLC report?

I am using RDLC to generate product receipt but facing issue with layout and design in RDLC.All my report contents are not coming in the center. My page size is 7.30 centimeter and I want this content to be in center of the report This is what I am trying to achieve(Expected Output) : https://i.sta...
1

votes
1

answer
114

Views

DataGridView is not committing updates to database

I used the designer to set the datagridview's data source to my SQL database table. On the RowLeave event, I use the BindingSource.EndEdit to commit the changes. However, the changes in the datagridview aren't being reflected in the database. The EndEdit is being called correctly. private void UI_DG...
B-Rian
1

votes
1

answer
63

Views

Binded DataGridView only updating the currently selected row

I'm working on getting my DataGridView controls to auto update the values of my objects in my object model. I have object arrays that I'm binding to my DataGridView through the following code Dim bs As BindingSource = New BindingSource() bs.DataSource = aryJoints DataGridJoints.DataSource = bs I am...
RobotGuy
1

votes
2

answer
158

Views

C# Handling two buttons within the DataGridView

I'm currently developing a C# project that displays the users' orders. Now, being that I am new to this I'm asking you to assist me on how I could possibly access the two buttons from within the DataGridView and give them separate functions. Where I've got at code wise: private void dataGridView1_C...
user7943
1

votes
0

answer
34

Views

Store logged in user for that session

We all know how easy it is to create a static class in c# and use that to reference that in a app but its a possible to make a variable that can change I am wanting to track the user id of a user once they have logged in in something like this public static class MyUser { public static int UserId {g...
rogue39nin
1

votes
1

answer
49

Views

C# Assistance in foreach datagridview data removal

Scenario: I am loading a DataGridView with data from a database, so in order to do so I'm using a foreach-loop, now the problem here is that when going on the DataGridView for the second time it loads the data from before and the data being looped in now. In order to fix that I did this: private vo...
user7943
1

votes
1

answer
163

Views

C# Winform How to change form nonclient area size?

I've already implemented a change to the size of the nonclient area but encountered a problem. Bug : Whenever I maximize the window and restore it again, its width and height will increase. This is my code: private void WmNcCalcSize(ref Message m) { if (m.WParam != IntPtr.Zero) { Win32.NCCALCSIZE_PA...
Zohn_Zhang
1

votes
1

answer
27

Views

How can I update my List loop in my DataGridView?

I have a list attached to the datasource of a gridview, when I make the change from my list in the status field I would like to change the status in gridview as well. My loop is through the datagridview and it is linked in my list, I think the problem is this? How can I update my List loop in my Dat...
Will
1

votes
1

answer
50

Views

unrendered portion for datagridview c#

So I'm doing a project on Win-forms using c# and i have this DataGridView that's anchored to the each left and right side of the panel. For some reason the right side of the DataGrid is not rendered for some reason.(image in the link below) If i rescaled my PC resolution when running it will fix the...
user9177098
1

votes
1

answer
53

Views

DropDownMenuItem check should uncheck other DropDownMenuItems

I'm creating a ToolStripMenuItem's DropDownItems at runtime. Me.mnuExtrasSecondaryLCID.DropDownItems.Clear() Dim iCount As Integer = -1 For Each nLang As clsLanguage In g_LCIDs If nLang.IsLeader Then iCount += 1 Dim n As New ToolStripMenuItem n.Name = 'mnuSecondaryLCID' & iCount.ToString() n.Text =...
tmighty
1

votes
0

answer
195

Views

Why is DataGridView (re)draw so slow?

I know there are several questions in SO about slow DataGridViews, but I tried really everything mentioned there and most are about more complex databinding. what I did before: I tested DataTable as Datasource unbound Datagridview, populated in a loop tested many setting with autoColumnResizing etc....
Falco Alexander
1

votes
1

answer
42

Views

Windows application compatible with Microsft Edge share command

Microsft Edge has a share command that sends a link to the current page to other apps like Mail, OneNote, Skype, etc. I'd like to obtain that my application appears in that list and can receive the target link. How can I get this functionality in my Windows Form application in C#? Or I need to conve...
Danilo.NET
1

votes
0

answer
167

Views

Double buffering during Resize when Control is docked to Form?

I have a custom Control derived class for which I want to disable any automatic double buffering completely because I want to handle double buffering manually with a BufferedGraphics object. Drawing is done in OnPaint, Invalidate is called in MouseMove and Resize events for example. However, if the...
oliver

View additional questions