Solved

user defined mapping question?

Posted on 2000-03-27
2
158 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
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

786 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