Attach Columns to Input Values in Code

I would like to attach a column from my data table to an input value in code. (This is more easily accomplished through the Test Studio UI.)

Soluiton

Use the Data object in conjunction with the column name or index.

In this example on Bing.com, I added the SbFormQText element to the Elements Explorer via the Add To Project Elements feature from the Elements Menu. Now I can reference that element in code and data drive its input text:

//Reference a column by name
Pages.Bing.SbFormQText.Text = Data["Col1"].ToString();

//Reference a column by index (zero based)
Pages.Bing.SbFormQText.Text = Data[0].ToString();
'Reference a column by name
Pages.Bing.SbFormQText.Text = Data("Col1").ToString()

'Reference a column by index (zero based)
Pages.Bing.SbFormQText.Text = Data(0).ToString()

This method can also be applied to a Verification:

//Reference a column by name
Assert.IsTrue(ActiveBrowser.ContainsText(Data["Col1"].ToString()));

//Reference a column by index (zero based)
Assert.IsTrue(ActiveBrowser.ContainsText(Data[0].ToString()));
'Reference a column by name
Assert.IsTrue(ActiveBrowser.ContainsText(Data("Col1").ToString()))

'Reference a column by index (zero based)
Assert.IsTrue(ActiveBrowser.ContainsText(Data(0).ToString()))