Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6676551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:00:11+00:00 2026-05-26T04:00:11+00:00

My project is using Visual Basic 2010. I have a pure text save file

  • 0

My project is using Visual Basic 2010. I have a pure text save file with the following format:

num_TEC|1
num_STR|0
num_PER|0
num_MEC|1
num_KNO|1
num_DEX|1

I’m trying to load the data by using the first column as the object name and the second as the value. I’ve had some success with the following (skipping some basic IO lines):

prop = FileReader.ReadLine().Split("|")
tempvar = prop(0)    

If TypeName(Me.Controls(tempvar)) = "NumericUpDown" Then
  Me.Controls(tempvar).Value = prop(1)

I have a problems with this because I have some objects in panels or group boxes and Me doesn’t reach into them.

Is there a way to just strictly reference an object with a variable? I’d love to assign the first column into prop(0) and just say

if TypeName(object(prop(0))) = "NumericUpDown" then
  object(prop(0)).Value = prop(1)

Can anybody help with this?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:00:11+00:00Added an answer on May 26, 2026 at 4:00 am

    I suggest add your control id into some kind of list or dictionary that contains all control that you defined and use as sample above.
    The list can be list of class controls that you defined or simple dictionary

    eg:
    add this as fields. String here means control ID, Object means

    private readonly Dictionary<String,Control> dictControl = new Dictionary<String,Control>();
    

    // add all controls that participate in your process. make sure it is unique name
    eg:

    private void yourMethodAllControl()
    {
        this.dictControl.Add(yourControl.Name, yourControl);
        ... add all your control and so on....
    }
    

    // set your values here

    private void SetValues()
    {
       .....// get all lines from files....
    foreach(String line in lines)
    {
       var query = from ctrl in this.dictControl
                   where ctrl.Key == line.Split(0)
                   select ctrl;
       var singleCtrl = query.First();
       singleCtrl.Value = line.Split(1);
    }
    
    }
    

    Basically the idea is make your is easier to operate by using dictionary, rather than boxing and unboxing and check for the control children; It is simply put them in the dictionary by using its name and its instance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Microsoft Visual Basic 2010 Express. I have a WPF-based project. I
I am using VB.NET 2010 (Visual Basic 2010 Express) on a WPF-based project. I
I am using visual studio 2010 and believe I have a project settings issue.
I'm using Visual Basic 6 for a legacy project and it's been working fine.
I'm trying to create a very basic Setup and Deployment project using Visual Studio.
I have created a setup project using Visual Studio 2008. After the application is
I am having an strange problem in visual studio 2010, visual basic, and using
I am using SQL Server 2008 in a Visual Basic 2010 application. I can
Im using visual basic 2010. Preparing a program. In my program when user presses
Using Visual Studio 2010 I created an Office 2010 Word add-in project that has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.