Skip to main content
InSource Solutions

TN AppSvr173 How to use the Microsoft.net Datagridview control in Application Server

insource logo large.jpg

 

Description

How to use the Microsoft.net Datagridview control in Application Server

 

  • Author: Mike Viteri
  • Published: 11/12/2015
  • Applies to: Application 3.0 and greater

 

 

Details

You can start using the DataGridView Control from the Microsoft.net Framework. You have to import it into the Galaxy.


This can be done by inside the IDE going to Galaxy->Import->Client Control.

datagrid.JPG

 

 

Then you have to browse to C:\Windows\Microsoft.NET\Framework\v4.0.30319 then import the system.windows.forms

datagrid2.JPG

 

then import the system.windows.forms

 

datagrid3.JPG

 

The Import will Start

 

datagrid4.JPG

 

Then finish

 

datagrid5.JPG

 

 

 

You will then see the import controls under the Graphic Toolbox

 

datagrid6.JPG

 

Create a new symbol in your graphic toolbox. We called our symbol testgrid in this example.

 

datagrid7.JPG

 

Open your new symbol and click on the embed Archestra Graphic button. Then from the Graphic Toolbox select "DataGridView".

 

datagrid8.JPG

 

This is what the embedded DataGridView will look like.

 

datagrid9.JPG

 

 

I have setup and deployed a user defined object called "datagridtest". It has three UDA's of CarMaker, CarColor and CarType. Each is an array with data below. We will use this data to populate the DataGridView.

 

datagrid10.JPG

 Create an "OnShow' Archestra Graphic script that will populate the columns of the grid. It will be a three column grid.

 

dataGridView1.ColumnCount = 3;
dataGridView1.ColumnHeadersVisible = true;
dataGridView1.Columns[0].Name = "CarMaker";
dataGridView1.Columns[1].Name = "CarColor";
dataGridView1.Columns[2].Name = "CarType";

 

datagrid11.JPG

 

If you embed the symbol on an Intouch window and go to runtime. You will see this below.

 

datagrid12.JPG

 

Next add the script to read the row data from the datagridtest  UDA's. This script adds a row of data when reading each UDA name and array.

 

datagridview1.Rows.Add(datagridtest.CarMaker[1],datagridtest.CarColor[1],datagridtest.CarType[1]);
datagridview1.Rows.Add(datagridtest.CarMaker[2],datagridtest.CarColor[2],datagridtest.CarType[2]);
datagridview1.Rows.Add(datagridtest.CarMaker[3],datagridtest.CarColor[3],datagridtest.CarType[3]);

 

 

datagrid13.JPG

 

 

Now if you go to runtime again on the DataGridView you should see the data that is being read of the object.

 

 

DataGrid14.JPG

 

All functions of the DataGridView Control can be found here:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview(v=vs.110).aspx