VB.NET - Can't get Integer to work

I'm working with Windows Forms Application in Visual Studio 2015, using .NET Framework 4.5.2. So I'm making a simple program which includes a label to display a value. The label (called lblMoney) displays the currency (in this case, $) and then the v...
more »

2017-07-15 23:07 (3) Answers

C# ArgumentOutOfRangeException when closing forms

I am writing a WinForms C# Program. I am trying to close all forms except my main form, FrmMain. I must hide my main form. I produced this by having two forms open. One with my main form, and one with another form shown with the ShowDialog() metho...
more »

2017-07-09 06:07 (1) Answers

How to get wpf window instance from winforms

After login I'm opening this Mainwindow MainWindow window = new MainWindow(); and closing the Login window. In the main window there is a windows form I'm initializing globally Scanner form = new Scanner(); I'm hiding and showing this Scanner ...
more »

2017-07-01 10:07 (3) Answers

Properly detect keyboard layout

I have a winforms application where I need to obtain the current keyboard layout of the user. To do that I'm using System.Windows.Forms.InputLanguage.CurrentInputLanguage.LayoutName. This works fine as long as the user has the form as his active win...
more »

2017-07-01 01:07 (2) Answers

Cross thread invoke exception

In order to change a control by another thread, I need to invoke a delegate to change the control However, it is throwing a TargetParameterCountException: private void MethodParamIsObjectArray(object[] o) {} private void MethodParamIsIntArray(int[] ...
more »

2017-06-17 14:06 (2) Answers

Downloading an .ico file from DuckDuckGo

I'm currently using the DuckDuckGo icon utility to fetch the favicon's for certain webpages, although in order to fetch an icon it requires you to add ".ico" at the very end of the request, for example: https://icons.duckduckgo.com/ip2/www.google.com...
more »

2017-06-17 08:06 (1) Answers

Windows Forms resized after loading WPF

I'm experiencing a strange behavior, one for which I currently do not have an explanation or a solution and I'm hoping someone knows something about this. So I have a simple Windows Forms application with a single button, which on button click will ...
more »

2017-06-11 12:06 (1) Answers

How to fill ContextMenuStrip in XAML?

I've created WPF application with NotifyIcon to work in tray. public partial class MainWindow : Window { public NotifyIcon NotifyIcon { get; } = new NotifyIcon { Icon = Properties.Resources.status_on_ico, Visible = true }...
more »

2017-06-06 14:06 (1) Answers

Searching in a listBox using backgroundWorker

This is a C# - WinForm question: I'm trying to search in a listBox. There's ONLY ONE listBox full of some items. On program load, all the items in the listBox, get copied into a List of type string called 'tempList'. There's also a TextBox. When the...
more »

2017-05-06 10:05 (2) Answers

How to handle System.OverflowException

I have one simple windows application in that amount Textbox is there. When i enter amount into amount textbox it will convert it to words in another textbox named txtrupees. Amount Textbox field maximum length is set to 11 places in that last 3 plac...
more »

2017-04-26 12:04 (2) Answers

Can't get App.config settings to persist

Problem: Value set by user on initial startup won't stay in App.config xml Desired functionality: Value set by user to stay stored in App.config unless changed by user I'm trying to make it so that the first time the application is run by the user ...
more »

2017-04-18 23:04 (1) Answers

C# SQL connection string best practice

I have a winforms application that connects to a database with a connection string and a generic user "Database=DBADAS;Server=TMT123\\SQLEXPRESS;User ID=user; Password=*****; After connecting into the database with a login dialog, we check if the ...
more »

2017-04-12 09:04 (2) Answers

How to check valid object in PropertyDescriptor?

I'm working in WinForms application and used the BindingList datasource. I need to check the whether the object is valid or not with PropertyDescriptor. because PropertyDescriptor.GetValue(object obj) will works for valid object. but sometimes i has...
more »

2017-03-07 14:03 (1) Answers

c# - How to deal with decimal

I have a numericUpDown and set the decimal places on properties to 3 so it became 0.000 Here is the code Decimal inputGrossWeight = numGrossWeight.Value; if (inputGrossWeight = 0.000) { MessageBox.Show("Gross Weight must be filled!"); } else ...
more »

2017-02-21 10:02 (1) Answers

C# WinForm Scintilla Find Text

Good day all, Below code is for a normal richtextbox to find all text as per 'search for' string. I'm using Scintilla and have tried to convert as far as possible for it to work. It works but not as it should. Any suggestions please? public static ...
more »

2017-02-15 20:02 (0) Answers