Sending values to text box in form
Hello,
I have a C# program that reads the ROM from a 1-wire device. This part is working fine so far. The issue I'm having is sending the data read from the device into a textbox on my form.
Code:
This is the Program.cs file that gets the data from the 1-wire chip.
I can display the ROM data in the console when calling the function readDevice();, but I want to be able to send it to a textbox on my Form1.cs.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Text;
namespace uni_1_Wire_Programmer_Candela
{
static class Program
{
//This file must be located in the bin folder of the C# GUI program
[DllImport("uni_1-Wire_ProgrammerDLL.dll")]
public static extern int ComPortInit();
[DllImport("uni_1-Wire_ProgrammerDLL.dll")]
public static extern int readDevice();
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main(string[] args)
{
ComPortInit();
readDevice();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
This is the Form1.cs file and I want to be able to display the data acquired from the readDevice(); function on textBox4.
Quote:
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 uni_1_Wire_Programmer_Candela
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void label2_Click(object sender, EventArgs e)
{
}
private void label6_Click(object sender, EventArgs e)
{
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
}
private void label5_Click(object sender, EventArgs e)
{
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
}
}
}
Any help will be greatly appreciated.