C# coding folks - pass string variable from Form to Form

Posted on 2013-06-11
Last Modified: 2013-06-17
Hello experts,

I have a Form.cs file, that contains a station_id variable that I want to pass to my next form:

        public Form1()
            System.Security.Principal.WindowsIdentity user =

                ITerminalServicesManager manager = new TerminalServicesManager();
                using (ITerminalServer server = manager.GetLocalServer())
                    foreach (ITerminalServicesSession session in server.GetSessions())
                        if (session.UserAccount != null && (user.Name.Split('\\')[1].ToLower() == session.UserName.ToLower()))
                            [b]string  station_id[/b] = Environment.MachineName + ":" + session.SessionId;

Open in new window

I also have a Form2.cs report with:

        public CrystalDecisions.Shared.IParameterField [b]Parameter_stationvariable[/b] {
            get {
                return this.DataDefinition.ParameterFields[1];

Open in new window

I want to build the code that will pass the station_id string to the Parameter_stationvariable in Form2cs above.  I am at a loss with C# - any ideas?

Question by:robthomas09
LVL 75

Accepted Solution

käµfm³d   👽 earned 400 total points
ID: 39238952
LVL 29

Assisted Solution

anarki_jimbel earned 100 total points
ID: 39239912

Author Closing Comment

ID: 39253596

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error on link 14 46
converto datetime always changes format 9 35
Call windows 10 virtual keyboard from windows forms app 2 32
.NET 2008 VB and C# 6 27
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: (…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now