Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

c# transfer data from class to form textbox

$
0
0

Dear Expert,

 I had successfull develop class for data collection however its display in command prompt, however how do i display this info in form textbox1, following is my class code

------------------------------------------------------------------------------------

using System;
using System.Management;

namespace remoteconnect
{
    class Program
    {
        static void Main(string[] args)
        {
           
            ManagementScope scope =
                new ManagementScope(
                    "\\\\computername\\root\\cimv2");

            scope.Connect();

            ObjectQuery query = new ObjectQuery(
                "SELECT * FROM win32_computersystem");
            ManagementObjectSearcher searcher =
                new ManagementObjectSearcher(scope, query);
            ManagementObjectCollection queryCollection = searcher.Get();
            foreach (ManagementObject m in queryCollection)
            {
                if (m.Properties["IsValid"].Value != null && m.Properties["IsValid"].Value.ToString() == "True")
                       m.Properties[""].Value.ToString(); 
                }

            }

               
            }
        }

----------------------------------------------------------------------------------------------------

In Form yet nothing

----------------------------------------------------------------------------------------------------

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 remoteconnect
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

    
        private void button1_Click(object sender, EventArgs e)
        {

        }
    }
}

----------------------------------------------------------------------------------------------------------

would you please assist in regards....


Support@Mytechnet.me


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>