SunQuest
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old September 1st, 2003, 08:50 PM
hamster84 hamster84 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Singapore
Posts: 21 hamster84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Picture and image errors

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.

Reply With Quote
  #2  
Old September 2nd, 2003, 12:20 AM
nopoints nopoints is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Windsor ON, Canada
Posts: 459 nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 13 h 44 m 22 sec
Reputation Power: 7
post code.
__________________
Programmer's Corner

Reply With Quote
  #3  
Old September 2nd, 2003, 01:07 AM
hamster84 hamster84 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Singapore
Posts: 21 hamster84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old September 12th, 2003, 12:12 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via MSN to cleverpig
Thumbs up

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Picture and image errors


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway