Your code:
ds = csccode.GetWEDAutoEmail
txt1.Text = ds.Tables("Email").Rows(0).Item("Subject")
The error means that something isn't there. The problem is likely one of these scenarios:
1. The GetWEDAutoEmail returned a dataset that was nothing
2. The dataset does not have a table named "Email"
3. The table "Email" does not have any rows
4. The table "Email" does not have a column named "Subject"
You will have to debug in order to figure out which. Place a break point on the line setting the text in txt1. When the breakpoint is hit, use quickwatch to narrow down which part is missing. You will either need to fix the GetWEAutoEmail or you will need to do checks before setting txt1.
*** UPDATE ***
How to use QuickWatch...well,
google[
^] has some articles on the topic...but glancing at them they don't have many nice screenshots. But maybe you'll want to look at them anyway. Basically when you've got your programming running and stopped at a breakpoint, you can highlight variables and see what their values are. So highlight just the
ds
in your line of code. At this point, you can probably see a popup that shows you more information and data that you've highlighted. You can use that popup, or you can right click and select QuickWatch from the menu. This pops up a menu where you can type in variables and bits of code and see what their values are. Since you had ds highlighted, ds should appear as the Expression that you are evaluating. If it has a value, you'll be able to see all of it's properties and thier values in the grid on the QuickWatch screen. If you can see that the
ds
has a value, then type in
ds.Tables("Email")
in the Expression textbox and press enter. Now you are checking to see if THAT has a value. Then type in
ds.Tables("Email").Rows(0)
to check for a value. Then tack on the .Item("Subject") and check that. It's kind of hard to explain, so you'll have to play with it a little bit to really get the hang of it. Hope this helps.