Frustration with simple walkthrough

S

Steve Howard

I am trying to work my way through this apparently simple walkthrough form
Microsoft:-

http://msdn.microsoft.com/library/d...con/html/vbwlkwalkthroughaccessingxmldata.asp


About half-way through it gives the following instruction:-

To add the code to create a new dataset that will receive the XML data

1.. With Form1.vb (VB users) or Form1.cs (C# users) selected in Solution
Explorer, click the View Code button in the Solution Explorer toolbar.
2.. In the declarations area, declare a new dataset named authors:
' Visual Basic
Dim dsAuthors As New DataSet("authors")

// C#
DataSet dsAuthors = new DataSet("authors");I am trying to do this as c#, and
I have been unable to find out where the 'declaration area' is supposed to
be. My web searches have not turned up any sort of defintion for this.I did
find this, which looks
helpful:-http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-csharp/39486/Declaration-AreaThe
questioner is clearly doing the same walk-through I am doing and has
encountered the same problem ... but the responses that helped him have not
helped me. I have tried to add the required code into a method declaration,
with no success. Seems like I am still not understanding what it is I should
do. I'd be grateful for any helpful comments or suggestions.TIASteve
 
S

Steve Howard

Not sure what happened to my formatting there. Let's try again ...


I am trying to work my way through this apparently simple walkthrough form
Microsoft:-

http://msdn.microsoft.com/library/d...con/html/vbwlkwalkthroughaccessingxmldata.asp


About half-way through it gives the following instruction:-

To add the code to create a new dataset that will receive the XML data

1.. With Form1.vb (VB users) or Form1.cs (C# users) selected in Solution
Explorer, click the View Code button in the Solution Explorer toolbar.
2.. In the declarations area, declare a new dataset named authors:
' Visual Basic
Dim dsAuthors As New DataSet("authors")

// C#
DataSet dsAuthors = new DataSet("authors");

I am trying to do this as c#, and I have been unable to find out where the
'declaration area' is supposed to be. My web searches have not turned up any
sort of defintion for this.I did find this, which looks helpful:-

http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-csharp/39486/Declaration-Area

The questioner is clearly doing the same walk-through I am doing and has
encountered the same problem ... but the responses that helped him have not
helped me. I have tried to add the required code into a method declaration,
with no success. Seems like I am still not understanding what it is I should
do. I'd be grateful for any helpful comments or suggestions.

TIA

Steve
 
M

Madhuri Gummalla [MSFT]

You can do this -
1. declare the DataSet variable along with the other private member
declarations as DataSet dsAuthors = null;
2. instantiate the data set in the constructor of Form1() as dsAuthors = new
DataSet("authors");
public class Form1 : System.Windows.Forms.Form

{

private System.Windows.Forms.DataGrid dataGrid1;

private System.Windows.Forms.TextBox textBox1;

private System.Windows.Forms.Button button1;

private System.Windows.Forms.Button button2;

DataSet dsAuthors = null;

/// <summary>

/// Required designer variable.

/// </summary>

private System.ComponentModel.Container components = null;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

dsAuthors = new DataSet("authors");

//

// TODO: Add any constructor code after InitializeComponent call

//

}


--
Thanks,
Madhuri
(Software Design Engineer/Test, Microsoft)

This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Steve Howard

Madhuri
You can do this -
1. declare the DataSet variable along with the other private member
declarations as DataSet dsAuthors = null;
2. instantiate the data set in the constructor of Form1() as dsAuthors =
new DataSet("authors");


Great - that's what I needed to know. I had worked out (finally!) something
very similar to what you suggested. I am glad to see that I managed to find
the right track :)


Thank you!


Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top