Click here to Skip to main content
15,909,325 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
Simon P Stevens21-Oct-08 0:58
Simon P Stevens21-Oct-08 0:58 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
arnold_w21-Oct-08 1:01
arnold_w21-Oct-08 1:01 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
Simon P Stevens21-Oct-08 1:07
Simon P Stevens21-Oct-08 1:07 
GeneralRe: How can I programmatically generate OnDrawItem events for a ComboBox? Pin
leppie21-Oct-08 3:20
leppie21-Oct-08 3:20 
QuestionKilling a Process Pin
Vimalsoft(Pty) Ltd20-Oct-08 22:38
professionalVimalsoft(Pty) Ltd20-Oct-08 22:38 
AnswerRe: Killing a Process Pin
Simon P Stevens20-Oct-08 22:51
Simon P Stevens20-Oct-08 22:51 
AnswerRe: Killing a Process Pin
Vimalsoft(Pty) Ltd21-Oct-08 20:03
professionalVimalsoft(Pty) Ltd21-Oct-08 20:03 
QuestionHow to alter the main GUI from another class/object? Pin
munk1220-Oct-08 21:55
munk1220-Oct-08 21:55 
I post this a C# newbie - please bear with me Smile | :)

I have coded a small project in C#, and ran into a problem illustrated in the below minimal project cs file.

CODE
---------------------------------
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;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

public static int ScanProgress
{
set
{
progressBar1.Value = value; // Error: An object reference is required for the non-static field, method, or property 'WindowsFormsApplication1.Form1.progressBar1' ...
}
}
}


public static class AnotherClass
{
public static void SetScanProgress(int Value)
{
WindowsFormsApplication1.Form1.ScanProgress = 17;
}
}
}
---------------------------------
/CODE

I get the error when I refer to the non-static progress bar in the set method?
I would like to be able to do something like this, to show the progress of a scanner from a callback function, in the main GUI.
Or more general - how do I alter the Main GUI from another class/object?

Thanks,
munk

AnswerRe: How to alter the main GUI from another class/object? Pin
leppie20-Oct-08 21:57
leppie20-Oct-08 21:57 
GeneralRe: How to alter the main GUI from another class/object? Pin
munk1221-Oct-08 23:42
munk1221-Oct-08 23:42 
QuestionPlease help with Drag and Drop Pin
User 543536420-Oct-08 21:25
User 543536420-Oct-08 21:25 
Questionhow i can Create Iphone application Pin
wasimsharp20-Oct-08 20:14
wasimsharp20-Oct-08 20:14 
AnswerRe: how i can Create Iphone application Pin
Ed.Poore20-Oct-08 21:23
Ed.Poore20-Oct-08 21:23 
GeneralRe: how i can Create Iphone application Pin
wasimsharp20-Oct-08 23:22
wasimsharp20-Oct-08 23:22 
AnswerRe: how i can Create Iphone application Pin
Simon P Stevens20-Oct-08 22:33
Simon P Stevens20-Oct-08 22:33 
Questionchange IP Pin
Hossein Afyuoni20-Oct-08 20:11
Hossein Afyuoni20-Oct-08 20:11 
AnswerRe: change IP Pin
Ed.Poore20-Oct-08 21:22
Ed.Poore20-Oct-08 21:22 
QuestionHow to Implement Context-Sensitive Help in .NET Applications Created with C#, Pin
tozy20-Oct-08 19:52
tozy20-Oct-08 19:52 
AnswerRe: How to Implement Context-Sensitive Help in .NET Applications Created with C#, Pin
Giorgi Dalakishvili20-Oct-08 20:10
mentorGiorgi Dalakishvili20-Oct-08 20:10 
Questionxmlrpc for .net cf... Pin
l a u r e n20-Oct-08 18:24
l a u r e n20-Oct-08 18:24 
AnswerRe: xmlrpc for .net cf... Pin
Ed.Poore20-Oct-08 21:24
Ed.Poore20-Oct-08 21:24 
QuestionHow to crop PictureBox Image when Stretched? Pin
saberbladez20-Oct-08 15:59
saberbladez20-Oct-08 15:59 
QuestionNot enough storage Pin
MAW3020-Oct-08 15:20
MAW3020-Oct-08 15:20 
AnswerRe: Not enough storage Pin
N a v a n e e t h20-Oct-08 17:05
N a v a n e e t h20-Oct-08 17:05 
AnswerRe: Not enough storage Pin
Ashfield20-Oct-08 21:16
Ashfield20-Oct-08 21:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.