Connecting Tech Pros Worldwide Forums | Help | Site Map

Runtime error 91

Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#1: Nov 26 '08
Hello everyone..
I m working on VB6 and SQLServer 2000.... i m getting an error in this line..


Private Sub txtAdjAmt_KeyPress(KeyAscii As Integer)
Dim vI As Integer
vI = LVPO.SelectedItem.Index
If KeyAscii = 13 Then
LVPO.ListItems(vI).SubItems(4) = txtAdjAmt.Text
txtAdjAmt.Visible = False
End If

Dim vI1 As Integer
vI1 = LvBill.SelectedItem.Index
If KeyAscii = 13 Then
LvBill.ListItems(vI1).SubItems(4) = txtAdjAmt.Text
txtAdjAmt.Visible = False
End If
End Sub


is anyone there to help me out to remove the error... there is a textbox when i press any key it give an error as " object variable or with block variable not set"
plz help me.
thank u in advance

QVeen72's Avatar
Moderator
 
Join Date: Oct 2006
Location: Bangalore
Posts: 1,385
#2: Nov 26 '08

re: Runtime error 91


Hi,

May be, No Item is selected in the list view "LvBill"

Regards
Veena
Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#3: Nov 26 '08

re: Runtime error 91


Hi

the selection is done bt still i m getting the same error.
can u help me out
thank u
QVeen72's Avatar
Moderator
 
Join Date: Oct 2006
Location: Bangalore
Posts: 1,385
#4: Nov 26 '08

re: Runtime error 91


Hi,

How are you populating "lvBill"....?
Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#5: Nov 26 '08

re: Runtime error 91


Private Sub LvBill_KeyPress(KeyAscii As Integer)
Dim vI1 As Integer
'If cmbpayType.Text = "B" Then
If LvBill.CheckBoxes = True Then
vI1 = LvBill.SelectedItem.Index
txtadjamt1.Left = LvBill.ColumnHeaders(5).Left + 280

txtadjamt1.Top = LvBill.ListItems(vI1).Top + 3600
txtadjamt1.Height = LvBill.ListItems(vI1).Height
txtadjamt1.Width = LvBill.ColumnHeaders(5).Width
txtadjamt1.Visible = True
txtadjamt1.Text = ""
txtadjamt1.SetFocus
End If
'End If
End Sub


this is my lvbill... i have one more lvbillpo which by filling up the lvbill and saving the listview wil show.. i have to set the adjamt and tdsamt in the lvbill to get tht..
QVeen72's Avatar
Moderator
 
Join Date: Oct 2006
Location: Bangalore
Posts: 1,385
#6: Nov 26 '08

re: Runtime error 91


Hi,

Change you Code like this and Check :

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtAdjAmt_KeyPress(KeyAscii As Integer)
  2. Dim vI As Integer
  3. If KeyAscii = 13 Then
  4.     vI = LVPO.SelectedItem.Index
  5.     LVPO.ListItems(vI).SubItems(4) = txtAdjAmt.Text
  6.     txtAdjAmt.Visible = False
  7. End If
  8.  
  9. Dim vI1 As Integer
  10. If KeyAscii = 13 Then
  11.     vI1 = LvBill.SelectedItem.Index
  12.     LvBill.ListItems(vI1).SubItems(4) = txtAdjAmt.Text
  13.     txtAdjAmt.Visible = False
  14. End If
  15. End Sub
  16.  
Regards
Veena
Familiar Sight
 
Join Date: Jan 2008
Posts: 137
#7: Nov 28 '08

re: Runtime error 91


ok.. thank u very much
Reply


Similar Visual Basic 4 / 5 / 6 bytes