Click here to Skip to main content
15,887,676 members
Home / Discussions / C#
   

C#

 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Member 1115157130-Oct-14 22:06
Member 1115157130-Oct-14 22:06 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Dave Kreskowiak31-Oct-14 7:44
mveDave Kreskowiak31-Oct-14 7:44 
AnswerRe: Old famous problem. Access to Form1 from other namespace Pin
Pete O'Hanlon29-Oct-14 5:54
mvePete O'Hanlon29-Oct-14 5:54 
SuggestionRe: Old famous problem. Access to Form1 from other namespace Pin
Richard Deeming29-Oct-14 6:46
mveRichard Deeming29-Oct-14 6:46 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Member 1115157130-Oct-14 22:08
Member 1115157130-Oct-14 22:08 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Member 1115157130-Oct-14 4:19
Member 1115157130-Oct-14 4:19 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Pete O'Hanlon30-Oct-14 4:29
mvePete O'Hanlon30-Oct-14 4:29 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Member 1115157130-Oct-14 5:42
Member 1115157130-Oct-14 5:42 
Now its working, but don;t change label1.Text. I think problem is in second instance of Form1. label1 is changing only second instance. But shown are first instance and label1 is in first instance.
Problem 2 - Two side or class on class declaration.

PS. Namespaces are in different files in project. New file is included in project with "Add exist element" and use with "using" with both side declaration.

using NamespaceTest;

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

        public string LabelText
        {
            get { return Label1.Text; }
            set { Label1.Text = value; }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Button was pressed");
            ClassTEST d = new ClassTEST();
          d.Changelabel();
            
        }
..


And added file
using System;
using WindowsFormsApplication3;

namespace NamespaceTest
{
    public class ClassTEST
    {
        // private Form1 form1;
        //public static ClassTEST
        //{  
        //form1 = form2;

        //}
        public void Changelabel()
        {


            Form1 form = new Form1();
            form.LabelText = "text";
        }


    }


modified 30-Oct-14 12:30pm.

GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Pete O'Hanlon30-Oct-14 5:44
mvePete O'Hanlon30-Oct-14 5:44 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Member 1115157130-Oct-14 6:29
Member 1115157130-Oct-14 6:29 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Pete O'Hanlon30-Oct-14 7:05
mvePete O'Hanlon30-Oct-14 7:05 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Member 1115157130-Oct-14 10:18
Member 1115157130-Oct-14 10:18 
AnswerRe: Old famous problem. Access to Form1 from other namespace Pin
OriginalGriff29-Oct-14 6:01
mveOriginalGriff29-Oct-14 6:01 
GeneralRe: Old famous problem. Access to Form1 from other namespace Pin
Member 1115157130-Oct-14 22:10
Member 1115157130-Oct-14 22:10 
QuestionBound DataGridView with unbound text box column Pin
Nigel Mackay28-Oct-14 23:54
Nigel Mackay28-Oct-14 23:54 
AnswerRe: Bound DataGridView with unbound text box column Pin
Eddy Vluggen29-Oct-14 9:51
professionalEddy Vluggen29-Oct-14 9:51 
GeneralRe: Bound DataGridView with unbound text box column Pin
Nigel Mackay29-Oct-14 15:42
Nigel Mackay29-Oct-14 15:42 
QuestionUnable to write to a parallel port Pin
Salman S7R28-Oct-14 20:12
Salman S7R28-Oct-14 20:12 
AnswerRe: Unable to write to a parallel port Pin
Garth J Lancaster28-Oct-14 20:23
professionalGarth J Lancaster28-Oct-14 20:23 
GeneralRe: Unable to write to a parallel port Pin
Salman S7R28-Oct-14 20:28
Salman S7R28-Oct-14 20:28 
AnswerRe: Unable to write to a parallel port Pin
Garth J Lancaster28-Oct-14 20:28
professionalGarth J Lancaster28-Oct-14 20:28 
GeneralRe: Unable to write to a parallel port Pin
Salman S7R28-Oct-14 20:30
Salman S7R28-Oct-14 20:30 
GeneralRe: Unable to write to a parallel port Pin
Garth J Lancaster29-Oct-14 1:53
professionalGarth J Lancaster29-Oct-14 1:53 
QuestionSQL connection in the app.config file? Pin
Member 245846728-Oct-14 17:54
Member 245846728-Oct-14 17:54 
AnswerRe: SQL connection in the app.config file? Pin
V.28-Oct-14 20:58
professionalV.28-Oct-14 20:58 

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.