Horizontal Scroll Bar

cant display value

Page 1 of 1

12 Replies - 2110 Views - Last Post: 25 March 2009 - 11:21 PM Rate Topic: -----

#1 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 93
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Horizontal Scroll Bar

Posted 24 March 2009 - 03:00 AM

hi
i recently added a scroll bar to change the value of the textbox but i cant seem to make it work. The value doesnt change and the rest of the problems are in a later post (scroll down) as well as the code.

SCROLL DOWN


This post has been edited by firebolt: 24 March 2009 - 11:14 PM

Is This A Good Question/Topic? 0
  • +

Replies To: Horizontal Scroll Bar

#2 Raju2047  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 55
  • Joined: 16-February 09

Re: Horizontal Scroll Bar

Posted 24 March 2009 - 08:27 AM

hey, i didn't understand in what u r doing programming "ToString(). if its in VB6 then please report ur problem clearly. i couldn't understand
Was This Post Helpful? 0
  • +
  • -

#3 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon

Reputation: 2298
  • View blog
  • Posts: 9,535
  • Joined: 29-May 08

Re: Horizontal Scroll Bar

Posted 24 March 2009 - 12:30 PM

@firebolt
This is what you get for Cut & Paste a VB.Net snippet.

VB.Net is fundamentally very different to VB6.
Was This Post Helpful? 0
  • +
  • -

#4 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 93
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: Horizontal Scroll Bar

Posted 24 March 2009 - 02:08 PM

Sorry guys. The wrong one. How can we drag the bar and let the value change as it gets dragged?? I've tried things like scrollRate.Drag = something but it doesnt seem to work. Is this to advanced for VB6?? thanks


This is the real one.
Private Sub scrollRate_Change()
   scrollRate.Min = 0
   scrollRate.Max = 100
   scrollRate.LargeChange = 10
   scrollRate.SmallChange = 1
   txtRate.Text = scrollRate.Value
End Sub
Private Sub scrollTerm_Change()
   scrollTerm.Min = 0
   scrollTerm.Max = 100
   scrollTerm.LargeChange = 10
   scrollTerm.SmallChange = 1
   txtTerm.Text = scrollTerm.Value
End Sub


Was This Post Helpful? 0
  • +
  • -

#5 Zhalix  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 260
  • Joined: 07-May 08

Re: Horizontal Scroll Bar

Posted 24 March 2009 - 04:10 PM

You need to use the Scroll event of the scrollbar as well as the Change event.

Also, I have some comments on your code. Why do you reset the properties every time the scrollbar is touched? It'd be better to just set them at design time or just once in your Form_Load event.
Was This Post Helpful? 0
  • +
  • -

#6 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: Horizontal Scroll Bar

Posted 24 March 2009 - 10:11 PM

Option Explicit

Private Sub Form_Load()
HScroll1.Min = 1
HScroll1.Max = 100
End Sub

Private Sub HScroll1_Change()
Text1.Text = HScroll1.Value
End Sub

Private Sub HScroll1_Scroll()
Text1.Text = HScroll1.Value
End Sub


Was This Post Helpful? 0
  • +
  • -

#7 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 93
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: Horizontal Scroll Bar

Posted 24 March 2009 - 10:30 PM

is there a way of making the (HScroll1.Min = 1 ) equal 0.5 and not 1??
Was This Post Helpful? 0
  • +
  • -

#8 Zhalix  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 260
  • Joined: 07-May 08

Re: Horizontal Scroll Bar

Posted 25 March 2009 - 12:35 AM

There isn't, but you can simulate that by making the max actually 200, and simply divide the value in half.
Was This Post Helpful? 0
  • +
  • -

#9 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 93
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: Horizontal Scroll Bar

Posted 25 March 2009 - 01:24 AM

So how would you code that?

Do we do: scrollRate.Max = 100 200 or something else??
Was This Post Helpful? 0
  • +
  • -

#10 Raju2047  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 6
  • View blog
  • Posts: 55
  • Joined: 16-February 09

Re: Horizontal Scroll Bar

Posted 25 March 2009 - 02:51 AM

yes
change max =200
and then

 txtTerm.Text =val( scrollTerm.Value)/2


Was This Post Helpful? 0
  • +
  • -

#11 Zhalix  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 260
  • Joined: 07-May 08

Re: Horizontal Scroll Bar

Posted 25 March 2009 - 03:20 AM

As Raju said, simply change the .Max property of the scrollbar to 200, and then when displaying the value in the textbox, divide it in half, like this:

txtTerm.Text = scrollTerm.Value / 2

Was This Post Helpful? 0
  • +
  • -

#12 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 93
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: Horizontal Scroll Bar

Posted 25 March 2009 - 10:13 PM

Thanks. !!!
Was This Post Helpful? 0
  • +
  • -

#13 Zhalix  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 260
  • Joined: 07-May 08

Re: Horizontal Scroll Bar

Posted 25 March 2009 - 11:21 PM

You're welcome.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1