Все, что я хочу сделать, это просто очистить текстовое поле одним нажатием кнопки.Я получаю эту ошибку
"Ошибка 2 Не удается неявно преобразовать тип 'string' в 'System.Windows.Forms.TextBox' C: \ Users \ Ed \ Downloads \ BT1_B \ BT1_B \ Form1.cs 108 36 BT1_B"
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.IO;
using InTheHand;
using InTheHand.Net;
using InTheHand.Net.Sockets;
using InTheHand.Net.Bluetooth;
namespace BT1_B
{
public partial class Form1 : Form
{
Guid service = new Guid("{00001101-0000-1000-8000-00805F9B34FB}");
BluetoothListener bl;
BluetoothClient bc;
bool radioAvailable = false;
bool listening = false;
delegate void SettbMessageReceivedCallback(string text);
public Form1()
{
InitializeComponent();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
try
{
listening = false;
bl.Stop();
}
catch
{
}
}
private void btn_listen_Click(object sender, EventArgs e)
{
try
{
BluetoothRadio.PrimaryRadio.Mode = RadioMode.Discoverable;
radioAvailable = true;
}
catch
{
MessageBox.Show("Please make sure Bluetooth is available");
}
if (radioAvailable)
{
bl = new BluetoothListener(BluetoothService.SerialPort);
bl.Start();
listening = true;
System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(ListenLoop));
t.Start();
}
}
private void ListenLoop()
{
try
{
while (listening)
{
bc = bl.AcceptBluetoothClient();
StreamReader sr = new StreamReader(bc.GetStream());
String message = sr.ReadLine();
sr.Close();
SettbMessageReceived(message);
}
}
catch
{
}
}
private void SettbMessageReceived(string text)
{
try
{
if (this.txt_incoming_message.InvokeRequired)
{
SettbMessageReceivedCallback d = new SettbMessageReceivedCallback(SettbMessageReceived);
this.Invoke(d, new object[] { text });
}
else
{
this.txt_incoming_message.Text += text + "\r\n";
}
}
catch (ThreadAbortException ex)
{
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void btn_clear_Click(object sender, EventArgs e)
{
txt_incoming_message.Clear();
}
}
}