Trying something new

LaTTicE

Member
Joined
Jun 14, 2004
Messages
11
Programming Experience
1-3
Due to the lack of response to my last post, I assume it is even harder than I thought it was. I have decided to try a different approach. I was wondering if anyone could tell me why this code is throwing this error and maybe, if you're feeling generous, what a solution might be... Thanks for any help.

Object reference not set to an instance of an object.

This sub procedure is simply what happens when the user clicks the Edit button on the datagrid. dgSearch is the id of the datagrid. Get EqTypeIndex is a function called to determine the index displayed in the drop down if the value in column EqTypeIDcell is not null
VB.NET:
[size=2][color=#0000ff]Sub[/color][/size][size=2] dgSearch_Edit([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]Object[/color][/size][size=2], [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] DataGridCommandEventArgs)

dgSearch.EditItemIndex = e.Item.ItemIndex

[/size][size=2][color=#0000ff]Call[/color][/size][size=2] Bind_Data()

[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] EqTypeIDcell [/size][size=2][color=#0000ff]As[/color][/size][size=2] TableCell = e.Item.Cells(8)

[/size][size=2][color=#008000]'Dim EditName As DropDownList = CType(e.Item.Cells(5).FindControl("ddldg"), DropDownList)

[/color][/size][size=2][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] EditName [/size][size=2][color=#0000ff]As[/color][/size][size=2] DropDownList = [/size][size=2][color=#0000ff]CType[/color][/size][size=2](dgSearch.FindControl("ddldg"), DropDownList)

[/size][size=2][color=#0000ff]If[/color][/size][size=2] EqTypeIDcell.Text = " " [/size][size=2][color=#0000ff]Then

[/color][/size][size=2]EditName.SelectedIndex = 0

[/size][size=2][color=#0000ff]Else

[/color][/size][size=2]EditName.SelectedIndex = GetEqTypeIndex(EqTypeIDcell.Text)

[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]If

[/color][/size][size=2][/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub

[/color][/size]
 
Top Bottom