# Getting Started with WinForms Chat

This article will give you getting started experience with **RadChat**.

## Adding Telerik Assemblies Using NuGet

To use `RadChat` when working with NuGet packages, install the `Telerik.UI.for.WinForms.AllControls` package. The [package target framework version may vary](https://www.telerik.com/products/winforms/documentation/visual-studio-integration/available-nugets).

Read more about NuGet installation in the [Install using NuGet Packages](https://www.telerik.com/products/winforms/documentation/installation-and-upgrades/install-using-nuget) article.

The speech-to-text button in the input area of the chat requires you to explicitly install the \[Microsoft.Web.WebView2]\(<https://www.nuget.org/packages/Microsoft.Web.WebView2]> NuGet package. Without this dependency, the default speech recognizer of the button throws an exception when the button initializes.

## Adding Assembly References Manually

When dragging and dropping a control from the Visual Studio (VS) Toolbox onto the Form Designer, VS automatically adds the necessary assemblies. However, if you're adding the control programmatically, you'll need to manually reference the following assemblies:

* **Telerik.Licensing.Runtime**
* **Telerik.WinControls**
* **Telerik.WinControls.UI**
* **TelerikCommon**

The Telerik UI for WinForms assemblies can be installed by using one of the available [installation approaches](https://www.telerik.com/products/winforms/documentation/installation-and-upgrades/installing-on-your-computer).

## Defining the RadChat

1\. To start using **RadChat** just drag it from the toolbox and drop it onto the form:

![WinForms RadChat RadChat Getting Started](https://www.telerik.com/products/winforms/documentation/assets/e6a97734c1fdec8354ae5596fdf16404/chat-items-getting-started001.png)

2\. Set the RadChat.**Author** property:

#### Setting default author

```C#

this.radChat1.Author = new Author(Properties.Resources.architect, "Ben");

```

```VB.NET
Me.radChat1.Author = New Author(My.Resources.architect, "Ben")
```

Now, you are ready to start sending messages:

![WinForms RadChat Setting default author](https://www.telerik.com/products/winforms/documentation/assets/1a9b56a76badb1c712072c1a1aae43f0/chat-items-getting-started002.gif)

By default, when you enter some input in the text box and press the `Enter` key to confirm the message, it is automatically added to **RadChat**. This is controlled by the RadChat.**AutoAddUserMessages** property which default value is *true*.  Once a message is confirmed either by pressing the `Enter` key or by clicking the arrow sign, the RadChat.**SendMessage** event is fired.

If the RadChat.**AutoAddUserMessages** property is set to *false* the message from the text box won't be automatically added to the messages' view. In the **SendMessage** event you can add the message programmatically.

#### Adding message programmatically

```C#

private void AddMessageProgrammatically()
{
    this.radChat1.AutoAddUserMessages = false;
    this.radChat1.SendMessage += radChat1_SendMessage;
}

private void radChat1_SendMessage(object sender, SendMessageEventArgs e)
{
    ChatTextMessage textMessage = e.Message as ChatTextMessage;
    textMessage.Message = "[Slightly changed message] " + textMessage.Message;
    this.radChat1.AddMessage(textMessage);
}

```

```VB.NET
Private Sub AddMessageProgrammatically()
    Me.radChat1.AutoAddUserMessages = False
    AddHandler Me.radChat1.SendMessage, AddressOf radChat1_SendMessage
End Sub

Private Sub radChat1_SendMessage(ByVal sender As Object, ByVal e As SendMessageEventArgs)
    Dim textMessage As ChatTextMessage = TryCast(e.Message, ChatTextMessage)
    textMessage.Message = "[Slightly changed message] " & textMessage.Message
    Me.radChat1.AddMessage(textMessage)
End Sub
```

![WinForms RadChat Adding Message Programmatically](https://www.telerik.com/products/winforms/documentation/assets/97bef589d9efdad02ef61aaac6d38b62/chat-items-getting-started003.gif)

## See Also

* [Overview](https://www.telerik.com/products/winforms/documentation/controls/chat/overview)

* [Messages](https://www.telerik.com/products/winforms/documentation/controls/chat/chat-items/messages)

* [Cards](https://www.telerik.com/products/winforms/documentation/controls/chat/chat-items/cards)

* [Overlays](https://www.telerik.com/products/winforms/documentation/controls/chat/chat-items/overlays)

* [Suggested Actions](https://www.telerik.com/products/winforms/documentation/controls/chat/chat-items/suggested-actions)

## Telerik UI for WinForms Learning Resources

* [Telerik UI for WinForms Chat Component](https://www.telerik.com/products/winforms/conversational-ui.aspx)
* [Getting Started with Telerik UI for WinForms Components](https://docs.telerik.com/devtools/winforms/getting-started/first-steps)
* [Telerik UI for WinForms Setup](https://docs.telerik.com/devtools/winforms/installation-and-upgrades/installing-on-your-computer)
* [Telerik UI for WinForms Converter](https://www.telerik.com/products/winforms/documentation/ai-coding-assistant/converter/converter)
* [Telerik UI for WinForms Visual Studio Templates](https://docs.telerik.com/devtools/winforms/visual-studio-integration/visual-studio-templates)
* [Deploy Telerik UI for WinForms Applications](https://docs.telerik.com/devtools/winforms/deployment-and-distribution/application-deployment)
* [Telerik UI for WinForms Virtual Classroom(Training Courses for Registered Users)](https://learn.telerik.com/learn/course/external/view/elearning/17/telerik-ui-for-winforms)
* [Telerik UI for WinForms License Agreement)](https://www.telerik.com/purchase/license-agreement/winforms-dlw-s)
