?
Solved

user defined mapping question?

Posted on 2000-03-27
2
Medium Priority
?
163 Views
Last Modified: 2012-05-04
Now essentially,

txtName(0) = 499
txtName(1) = 581
....
txtName(16) =539
....

Great, now I need to add that other element that I mentioned before.  Essentially, I want a user to have the option to "remapped" what value goes to what text box"  Thus a users could decide that 539 could be displayed in txtName(2).text.  I added another array of 32 textboxes called txtUserDefinedLocation to accommodate this element.  See code and modifed code below.


'-----------Current code-------------

  Dim i As Integer
   
  For i = 0 To 31
    If i < 16 Then
      txtName(i).text = 499 + i * 82
    Else
      txtName(i).text = 539 + (i - 16) * 82
    End If
  Next
'------------Modified code------------
Dim i As Integer
Dim iItem As Integer
   
  For i = 0 To 31
    If i < 16 Then
iItemNr = CInt(txtUserDefinedLocation(i).Text) - 1
      txtName(i).text = 499 + iItemNr * 82
    Else
iItemNr = CInt(txtUserDefinedLocation(i).Text) - 1
      txtName(i).text = 539 + (iItemNr - 16) * 82
    End If
  Next

' ----------end of modified code-----
Can someone tell me what is wrong with the modifed code, it only works it when txtUserDefinedLocation(0 To 15).text =1 To 16.  and when

txtUserDefinedlocation(16-31).text = 16 To 32

But
txtUserdefinedLocation(0-31) should be able to accept 1 To 32

Or is there a better way to do this.  




   



0
Comment
Question by:ptran2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 260 total points
ID: 2661664
Not sure I understand correctly, is this what you mean?

Dim i As Integer
Dim iItem As Integer
   
  For i = 0 To 31
iItemNr = CInt(txtUserDefinedLocation(i).Text) - 1
      If iItemNr < 16 Then
      txtName(iItemNr).text = 499 + iItemNr * 82
      Else txtName(iItemNr).Text = 539 + (iItemNr - 16) * 82
      End If
  Next



0
 

Author Comment

by:ptran2000
ID: 2661715
For some reason i changed txtName(iItemNR) to txtName(i) and it worked,

thanks


Dim i As Integer
Dim iItem As Integer
     
  For i = 0 To 31
iItemNr = CInt(txtUserDefinedLocation(i).Text) - 1
      If iItemNr < 16 Then
      txtName(i).text = 499 + iItemNr * 82
      Else txtName(i).Text = 539 + (iItemNr - 16) * 82
      End If
  Next

0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month9 days, 20 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question