Solved

user defined mapping question?

Posted on 2000-03-27
2
156 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
2 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 65 total points
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Determine Range to Select 5 33
How to debug this code 7 49
Excel - Save a copy of work book 13 79
using web browser with BING 40 84
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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now