Results 1 to 5 of 5

Thread: Choose from a list of variables or array

  1. #1
    Join Date
    Jun 2009
    Posts
    3,859

    Choose from a list of variables or array

    I am currently developing an application where the user name field is the name of his choice. This will allow you to customize the interface and thus make it more user friendly)

    To do this:
    I asked a series of TextBox (12) with a label attached to each TextBox on a form of configuration
    I edit a line of code to use the name of the label if the TextBox is empty.
    I gave the possibility to lock or unlock the TextBox to prevent accidental changes
    I created a file "Config.txt" to save the contents of my textBox
    I write code that can write to this file. Each data is separated by a comma.
    I wrote the code to read this file. It is able to separate the data between 2 commas
    This file will be read at the opening of the application and inform the labels associated with objects.

    So much for principle.

    For practice, I have yet to create a new variable containing the names of objects (TextBox contents of my Form Configuration). The content of these variables will be written in my file config.txt.

    But in your opinion, what is preferable, using a variable for each TextBox or creating a table containing all the names of all my TextBox? In terms of writing this does not change much. But is it better to declare 12 String variables or a array containing 12 String ? When should I use a table rather than independent variables?

  2. #2
    Join Date
    Nov 2008
    Posts
    996

    Re: Choose from a list of variables or array

    In my opinion the easiest is to make a table if you have your name in 12 fields in the incrementing order like blabla1, blabla2, ..., and you can save your 12 fields with a loop.

    But, in your explanation you say that the contents of each field is separated by a comma (in your config.txt file), then further separated when it is replayed. Have you considered the possibility that a user puts a comma in a field?

  3. #3
    Join Date
    Jun 2009
    Posts
    3,859

    Re: Choose from a list of variables or array

    It corresponds to what I print and therefore reinforces my choice.

    To your question ... You're right, we must predict.

    However, as these are name objects. (these items are buttons that the user need to change depending on the desired action). This button will command grid switching and instead of In1, In2, etc ... it will put Cam1 etc. or VTR1.

    There is very little chance that he put a comma in the name. However, you're right and I just completely banned the use of the decimal point in testing the conent field and open a MsgBox in case the user still trying to do. This should be possible. I have not imagined how but I will look myself.
    Besides if you have an idea ...

  4. #4
    Join Date
    Nov 2008
    Posts
    1,192

    Re: Choose from a list of variables or array

    Code:
    Option Explicit 
    
    Private Sub UserForm_KeyDown (ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) 
    Select Case KeyCode 
    Case vbKeyF1: MsgBox "F1" 
    Case vbKeyF2: MsgBox "F2" 
    End Select 
    End Sub
    Then, the message box that says it is forbidden to enter a particular letter, I find it cumbersome to use. I prefer the solution to replace the comma with a space without saying anything (if it is not important). Left to indicate the tip that the comma is prohibited and add an error message in the bar downstairs.

  5. #5
    Join Date
    Jun 2009
    Posts
    3,859

    Re: Choose from a list of variables or array

    Thank you void. I immediately leaned on this procedure (which I do not know). I will tell you how it spends that I got.

    To MsgBox, you're probably right because the unsolicited messages would be irritating. It is however important to tell the user to not input a character prohibited. A infobar is enough? I almost never read them. But I will take your advice to use with user feedback.

Similar Threads

  1. How can you remove and insert an object in the array list ?
    By GOOL in forum Software Development
    Replies: 4
    Last Post: 03-01-2011, 11:29 PM
  2. Help me choose the best card from list.
    By sim_tcr in forum Monitor & Video Cards
    Replies: 19
    Last Post: 05-02-2010, 10:18 PM
  3. Add new contacts to an existing array list
    By Carnie in forum Software Development
    Replies: 3
    Last Post: 28-11-2009, 01:11 PM
  4. Assigning an array to an array
    By MACE in forum Software Development
    Replies: 3
    Last Post: 18-11-2009, 05:19 PM
  5. Which Graphic Card Would You Choose?(whole List)
    By ApPy10 in forum Monitor & Video Cards
    Replies: 3
    Last Post: 16-12-2006, 04:21 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,716,989,176.90609 seconds with 16 queries