Relative Content

Tag Archive for c#.netwinforms

Adding Squeduled Task to a VM

I’m trying to add a Squeduled Task to my VM, but i keep getting the following error:
– (HRESULT: 0x80070032).
Here is my code for adding the task:

Cannot change or use global variables in C# (WinForms .NET)

I’ve declared a few int variables inside public partial class Form1 : Form in C#. However, i can’t use or change them if it isn’t done inside a function (e. g. inside of private void button1_click), as if the variables never existed. It gives a “”IDE1007: The name ‘r’ does not exist in the current context” error when trying to change tha value of r. That said, I can’t create a pen using Pen dot = new Pen(Color.FromArgb(r, g, b));, trying to do so gives another error, “CS0236: A field initializer cannot reference the nonstatic field, method, or property from “Form1.r”” (I’m trying to make a sort of MS Paint clone).

Bulk copying excel to a sql database copies a column incorrectly

I’m trying to do a bulk copy of the contents of an excel sheet to a SQL Table. The thing is, there is a column in the excel sheet that is called ISBN , almost all the time the values are composed of numbers (always integers), but sometimes, it has some letters, like an X. But after the bulk copy is done and I check those records that have letters in the ISBN column, the ones that have a letter are null. So, this column should be treated as a string (everything is set-up to do so but I can’t find out why it does not).

How to navigate between Window Forms in C++

I am new to C++ and .Net Framework, I am using it build a Windows Application that has a login feature. The login form then goes into a User Interface according to the type of the user. This form will have a logout button once pressed, it will close this form and opens the login form. The problem is that once opening the login form, my logic makes the application finishes and return 0 at the end. How can I make it that it will never end until user explicitly presses the close button ?