Text box scrolling

I am trying to create an invoice form ( 2 fields - Description and Amout). I do not want to use an OLE control using Excel or any other spreadsheet. I would like to use a  text box for the description field and a grid control or another text box for the amount field. Is there any way to set the scroll bars of each so they are in lock? That is, when you scroll the text box, the grid control scrolls also, and vice versa.
dmoore2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chualkCommented:
use listbox instead of textbox. It is easier to program.
0
TimCotteeHead of Software ServicesCommented:
I would agree that a listbox is easier in this scenario. However if you are already going to use a grid control why can you not have two columns in the grid to display the information so as to avoid the locking of the two scroll bars.

If you really must do this then you would have to program something on the scroll event of each control to ensure that whichever one was moved moves the other one in the same direction by the same amount.

Here is an example of using two listboxes with the scrolling locked.

Private Sub Form_Load()
    For intCount = 1 To 20
        List1.AddItem CStr(intCount)
        List2.AddItem CStr(intCount)
    Next
End Sub

Private Sub List1_Scroll()
    List2.TopIndex = List1.TopIndex
End Sub

Private Sub List2_Scroll()
    List1.TopIndex = List2.TopIndex
End Sub
0
dmoore2Author Commented:
I can not use a grid control or a list box for the description field because I need full edit capability. I need to be able to move the cursor to a selected point in the field. I need cut and paste, add and delete character capability. Any other suggestions on how to do this?
0
pablocastaCommented:
Add 2 Text boxes (Text1 and Text2), a Data control (Data1) and 2 UpDown controls (UpDown1 and UpDown2). Put them near the text boxes, in the same way as those in which you increment a value displayed in the text boxes (see Word's Format|Paragraph, and you'll understand what I'm talking about)

UpDown control can be found -Microsoft Windows Common Control 2 5.0 SP2, in my case-

Now select the database you want changing the DataBaseName of the Data1 from the Properties Window. Now select the table you want to use from the list displayed in the RecordSource property.
Once done this change both Text boxes DataSource properties to Data1 (which is the data control we were just talking about) and select the field you want that text box to display from the list in the DataField property.

Add the following code
Private Sub UpDown1_DownClick()
If Data1.Recordset.EOF = True Then
Data1.Recordset.MoveLast
Else
Data1.Recordset.MoveNext
End If
End Sub

Private Sub UpDown1_UpClick()
If Data1.Recordset.BOF = True Then
Data1.Recordset.MoveFirst
Else
Data1.Recordset.MovePrevious
End If
End Sub

Private Sub UpDown2_DownClick()
If Data1.Recordset.EOF = True Then
Data1.Recordset.MoveLast
Else
Data1.Recordset.MoveNext
End If
End Sub

Private Sub UpDown2_UpClick()
If Data1.Recordset.BOF = True Then
Data1.Recordset.MoveFirst
Else
Data1.Recordset.MovePrevious
End If
End Sub

Hope it works.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.