Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can somebody help me with my query

if(chk1.Checked == true)
{
    if(chk2.Checked.Checked == true)
    {
        chk4.Checked == true;
        //from here the pointer should goto (1) statement
    }
}
else
{
    //here i want to send the pointer              (1)
    chk3.Checked == false;
}


how to send pointer from line 6 to line 11.
Posted
Updated 24-Jan-14 0:04am
v4
Comments
CPallini 23-Jan-14 5:47am    
What do you mean with 'pointer in C# windows form'?
I mean if you are asking about C# pointer types, they have nothing to do with Windows Forms.

Pointers are discouraged in C#: they are available, but only when you change your project to permit unsafe code and also use the unsafe keyword: http://msdn.microsoft.com/en-us/library/chfa2zb8.aspx[^]

There is a tutorial here: http://msdn.microsoft.com/en-us/library/aa288474(v=vs.71).aspx[^] on unsafe code, but to be honest, if you are trying to use it and you don;t know what you are doing, then you have probably got the design of your project wrong. You should only need pointers when dealing with external code not written in C# (and most of the time, not even then) or when you need serious performance in a small chunk of code. In both cases, if you don't already know how to use this, you probably shouldn't need to do it at all.
 
Share this answer
 
Comments
agent_kruger 23-Jan-14 5:55am    
please, remove the answer sir as i have changed the question.
OriginalGriff 23-Jan-14 6:00am    
No - because your question now makes even less sense than it did...what the heck are you actually trying to achieve? Do you know what a pointer is? If not, what are you using the term, and what are you actually trying to do?
(And why do you think that boolean values should have a "Checked" property?)
agent_kruger 23-Jan-14 6:12am    
no sir, actually i cannot post the code and to ask the question had to make that example up.
OriginalGriff 23-Jan-14 6:36am    
Then you can't expect us to answer the question unless you give us a description which matches what you are actually trying to do! :laugh:

So, talk to me: what are you trying to do? What are you trying to achieve (and forget the word "pointer" for the moment)
agent_kruger 23-Jan-14 21:37pm    
i want to use a pointer that is defined in different scope and called in different scope.
Sending 'pointer' to (1) is 'pointless' :-).

Even if technically feasible, since the C# programming language features the goto statement, it would be one of the very bad ways to use the latter.

You could accomplish the same effect (if it makes sense) adding the statement
chk3.Checked == false;

just below (or just above ) the
Quote:
//from here the pointer should goto (1) statement

line.
 
Share this answer
 
Comments
agent_kruger 23-Jan-14 6:11am    
no sir, actually i cannot post the code and to ask the question had to make that example up.
agent_kruger 23-Jan-14 6:12am    
i want to use a pointer that is defined in different scope and called in different scope.
CPallini 23-Jan-14 6:25am    
That's not feasible in C# (no lognjmp, sorry!) and you should possibly re-design the (probably poor) code.
agent_kruger 22-Feb-14 23:18pm    
sir, that's not the code just a concept i want to learn.
agent_kruger 21-May-14 11:28am    
sir, there is no need for me to re-designing as i have only posted the question to know that "if a declared variable in one scope can be used in another scope or not"?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900