Click here to Skip to main content
15,908,768 members
Home / Discussions / C#
   

C#

 
QuestionI don't understand why I can't access a function from my Form instance from another class in the same namespace Pin
haz1322-Jul-06 3:13
haz1322-Jul-06 3:13 
AnswerRe: I don't understand why I can't access a function from my Form instance from another class in the same namespace Pin
NaNg1524122-Jul-06 3:28
NaNg1524122-Jul-06 3:28 
QuestionRe: I don't understand why I can't access a function from my Form instance from another class in the same namespace Pin
haz1322-Jul-06 4:11
haz1322-Jul-06 4:11 
AnswerRe: I don't understand ... Pin
Ravi Bhavnani22-Jul-06 4:29
professionalRavi Bhavnani22-Jul-06 4:29 
GeneralRe: I don't understand ... Pin
haz1322-Jul-06 5:25
haz1322-Jul-06 5:25 
GeneralRe: I don't understand ... Pin
Ravi Bhavnani22-Jul-06 5:39
professionalRavi Bhavnani22-Jul-06 5:39 
GeneralRe: I don't understand why I can't access a function from my Form instance from another class in the same namespace [modified] Pin
BoneSoft22-Jul-06 5:36
BoneSoft22-Jul-06 5:36 
QuestionRe: I don't understand why I can't access a function from my Form instance from another class in the same namespace Pin
haz1322-Jul-06 6:12
haz1322-Jul-06 6:12 
Thanks a lot for that, you were exactly right! I have slightly altered my code to cut down on the form reference passing. However when I try compling it it throws up an error - Compiler Error CS0120 - Error Message
"An object reference is required for the nonstatic field, method, or property 'member' " and refers to line

NumberProcessing.UpdateNumArray(this);

I am guessing there is a problem with the "this" value?

Any suggestions what is wrong??? Code is below.

namespace RouletteV1<br />
{<br />
    public partial class Form1 : Form<br />
    {<br />
        public Form1()<br />
        {<br />
            InitializeComponent();<br />
        } <br />
<br />
        private void btn1_Click(object sender, EventArgs e)<br />
        {<br />
            NumberAttributes.Load(1);<br />
            NumberProcessing.UpdateNumArray(this);<br />
        }<br />
<br />
        public void SetFormData()<br />
        {<br />
            tboxNumArray.Text = "Hello";<br />
        }    <br />
      <br />
    public class NumberProcessing<br />
    {<br />
        <br />
       public void UpdateNumArray(Form1 form)<br />
        {<br />
            form.SetFormData();  <br />
        }    <br />
    }<br />
}


Thanks in advance for your help Smile | :)

Haz

AnswerRe: I don't understand why I can't access a function from my Form instance from another class in the same namespace Pin
haz1322-Jul-06 6:33
haz1322-Jul-06 6:33 
Questionworking with datagrids in Windows Forms [modified] Pin
Rocky#22-Jul-06 2:28
Rocky#22-Jul-06 2:28 
AnswerRe: working with datagrids in Windows Forms Pin
Igor Sukhov22-Jul-06 5:43
Igor Sukhov22-Jul-06 5:43 
GeneralRe: working with datagrids in Windows Forms Pin
Rocky#23-Jul-06 9:56
Rocky#23-Jul-06 9:56 
GeneralRe: working with datagrids in Windows Forms Pin
Igor Sukhov23-Jul-06 13:59
Igor Sukhov23-Jul-06 13:59 
GeneralRe: working with datagrids in Windows Forms Pin
Rocky#23-Jul-06 21:14
Rocky#23-Jul-06 21:14 
QuestionGet the value of a field in a row Pin
Glen Harvy22-Jul-06 2:26
Glen Harvy22-Jul-06 2:26 
AnswerRe: Get the value of a field in a row Pin
albCode22-Jul-06 2:34
albCode22-Jul-06 2:34 
GeneralRe: Get the value of a field in a row Pin
Glen Harvy22-Jul-06 3:02
Glen Harvy22-Jul-06 3:02 
GeneralRe: Get the value of a field in a row [modified] Pin
albCode22-Jul-06 3:06
albCode22-Jul-06 3:06 
GeneralRe: Get the value of a field in a row Pin
Glen Harvy22-Jul-06 3:43
Glen Harvy22-Jul-06 3:43 
QuestionConverting string into byte[] Pin
Mursil22-Jul-06 2:08
Mursil22-Jul-06 2:08 
AnswerRe: Converting string into byte[] Pin
Nader Elshehabi22-Jul-06 2:16
Nader Elshehabi22-Jul-06 2:16 
GeneralRe: Converting string into byte[] Pin
Mursil22-Jul-06 2:21
Mursil22-Jul-06 2:21 
GeneralRe: Converting string into byte[] Pin
Nader Elshehabi22-Jul-06 2:31
Nader Elshehabi22-Jul-06 2:31 
GeneralRe: Converting string into byte[] Pin
Mursil22-Jul-06 2:45
Mursil22-Jul-06 2:45 
GeneralRe: Converting string into byte[] Pin
Nader Elshehabi22-Jul-06 4:35
Nader Elshehabi22-Jul-06 4:35 

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.