|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Hello!
I am using visual basic 6. For my application, i have 2 pictureboxes and 1 image array. picInner and picOuter are the 2 picbox. picOuter contains picInner and the image array will be loaded on to picInner. Runtime error 6: Buffer Overflow will pop up whenever my image array loaded is more than the picOuter.width. I not sure where my error are. Thanks for reading my post. Any help and suggestion will be deeply appreciated. ![]() |
|
#2
|
|||
|
|||
|
post code.
__________________
Programmer's Corner |
|
#3
|
|||
|
|||
|
Option Explicit
Dim n As Integer Dim WithEvents cnn As ADODB.Connection Dim WithEvents rst As ADODB.Recordset Private Sub cmdFind_Click() Dim f As ADODB.Field Dim sFind, cri As String Dim posRec As Integer Dim counter, inc As Integer sFind = Trim(txtBID.Text) rst.Find "Bearer_ID LIKE " & "'" & sFind & "*'" posRec = rst.AbsolutePosition If posRec > adPosBOF Then For Each f In rst.Fields If IsNull(f.Value) Then '<Null> Else '<non-null> counter = counter + 1 For n = 0 To counter Load imgbox(imgbox.UBound + 1) 'Load imgbox() array inc = inc + 2000 With imgbox(imgbox.UBound) ' imgbox property .Picture = LoadPicture(App.Path & "\circle.gif") .Left = inc .Top = 2000 .Width = 700 .Height = 700 .Visible = True End With Next If imgbox(imgbox.UBound).Left > picOuter.ScaleWidth Then End If End If Next Else MsgBox "Records Not Found", vbInformation + vbOKOnly, "Record Not Found" End If End Sub Private Sub Form_Load() Dim cnnstr As String Set cnn = New ADODB.Connection Set rst = New ADODB.Recordset cnnstr = "Select * from Node" With cnn .Provider = "Microsoft.Jet.OLEDB.4.0" .ConnectionString = "Data Source=C:\My Documents\My Project\bearer.mdb" .Open End With With rst .CursorLocation = adUseClient .CursorType = adOpenDynamic .LockType = adLockOptimistic .Open cnnstr, cnn End With End Sub Private Sub mnuExit_Click() 'EXIT MENU End 'exit program End Sub Private Sub HBar_Change() picInner.Left = -1000 * HBar.Value If HBar.Value = 0 Then picInner.Left = 240 End Sub Private Sub HBar_Scroll() picInner.Left = -1000 * HBar.Value If HBar.Value = 0 Then picInner.Left = 240 End Sub Last edited by hamster84 : September 2nd, 2003 at 11:01 PM. |
|
#4
|
|||
|
|||
|
I test this code is fine:
counter = counter + 1 For n = 0 To counter Load imgbox(imgbox.UBound + 1) 'Load imgbox() array inc = inc + 2000 With imgbox(imgbox.UBound) ' imgbox property .Picture = LoadPicture(App.Path & "\circle.gif") .Left = inc .Top = 2000 .Width = 700 .Height = 700 .Visible = True End With Mybe some wrong in here: Private Sub HBar_Change() picInner.Left = -1000 * HBar.Value If HBar.Value = 0 Then picInner.Left = 240 End Sub Private Sub HBar_Scroll() picInner.Left = -1000 * HBar.Value If HBar.Value = 0 Then picInner.Left = 240 End Sub |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Picture and image errors |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|