Forum Sains Indonesia
Ilmu Terapan => Ilmu Komputer => Topik dimulai oleh: Paulima Samosir pada Februari 04, 2010, 10:28:38 AM
saya ingin menjalanjan program di bawah ini dengan menggunakan vb.net 2003 tetapi ada error, Expression Expected...
Private Sub DisableControls(ByVal dgrRevise As Control)
Dim ddlApprove As New DropDownList
Dim l As Literal = New Literal
Dim name As String = String.Empty
Dim i As Integer
For i = 0 To i < dgrRevise.Controls.Count
--If (dgrRevise.Controls(i).GetType() == TypeOf (ddlApprove) Is DropDownList)) Then--> error disini
l.Text = CType(dgrRevise.Controls(0), TextBox).Text
dgrRevise.Controls.Remove(dgrRevise.Controls(i))
dgrRevise.Controls.AddAt(i, l)
If dgrRevise.Controls(i).HasControls() Then
DisableControls(dgrRevise.Controls(i))
End If
End If
Next
End Sub
saya bingung, tand errornya ada di == tetapi jika dihilangkan salah satu malah jadi error semuanya.. :-[
mohon bantuanny y, ini sangat genting....!!!!!!
tq..
maaf saya masih newbie di bahasa VB.Net, tapi kalo diliat dari logika program diatas, anda menggunakan perintah if untuk meng-"compare" antara control dari parameter drgRevise yang ke-i dengan variabel ddlApprove yang bertipe DropDownList. Benarkah?
hmm.. coba pake ini :
Private Sub DisableControls(ByVal dgrRevise As Control)
Dim ddlApprove As DropDownList = New DropDownList
Dim l As Literal = New Literal
...
...
If TypeOf dgrRevise.Controls(i) Is DropDownList Then
...
...
Next
End Sub