473,799 Members | 2,900 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert String Value into a Variable name?

27 New Member
The title says it all, I need to converta string into a varialbe so that I can gain another value. here is the code so far:

Expand|Select|Wrap|Line Numbers
  1. sub ValidateValues()
  2.  
  3.     DFData = "DatadField1,DatadField2,DatadField3,DatadField4,DatadField5"
  4.     DFDataArry = split(DFData,",")
  5.  
  6.     DFTitle = "DF1Title,DF2Title,DF3Title,DF4Title,DF5Title"
  7.     DFTitleArray = split(DFTitle,",")
  8.  
  9.     dim DFF, DatadField, DF, Title
  10.  
  11.     for DfLoop = 0 to DfLoopCount
  12.  
  13.     DFF = DfLoop + 1
  14.  
  15.     if GetValue(DFDataArry(DfLoop)) = "" then
  16.         AddErrorMess("Value for" & GetValue(DFTitleArray(DfLoop)) & "has not been entered.")
  17.     end if
  18.  
  19.     response.Write( DFDataArry(DfLoop) )
  20.  
  21.     next
  22.  
  23.     if errormess <> "" Then
  24.  
  25.     response.Write("<p class=""red"">" & errormess & "</p>")
  26.  
  27.     end if
  28.  
  29. end sub
  30.  
  31. function AddErrorMess(errmess)
  32.  
  33.     if errormess = "" then
  34.         errormess = errormess & errmess
  35.     else
  36.         errormess = errormess & "<br>" & errmess
  37.     end if
  38.  
  39. end function
  40.  
  41. Function GetValue(sItem)  
  42.  
  43. GetValue = sItem.Value  
  44.  
  45. End Function 
As you can see I have a lop that goes through the 5 different variables.

Any Ideas?

Cheers
Jul 22 '09 #1
1 3869
Frinavale
9,735 Recognized Expert Moderator Expert
Even after looking through your code I don't understand what you are trying to accomplish.

It is always a good idea to specify the Type expected for a variable...it's also a good idea to use better variable names than something like "DFF".

Anyways, I think you're interested in checking out Reflection. I'm not sure though because I don't have a clear understanding of what you're trying to do or Why.

-Frinny
Jul 23 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
5392
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and calculate days, months, and years. This is not for a college course. It's for my own personal genealogy website. I'm stumped about the code. I'm working on it but not making much progress. Is there any free code available anywhere? I know it...
4
3637
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is of the type the object is instantiated with. In my test program I have Option<std::string> and Option<long>. Here's the code for OptionBase and Option along with a small helper function. In the code are comments describing my problem, look closely...
12
3864
by: DC Gringo | last post by:
How can I convert this pubLatest to a date with format "m/d/yyyy"? Dim pubLatest As New Date pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Value -- _____ DC G
5
2728
by: manmit.walia | last post by:
Hello All, I am stuck on a conversion problem. I am trying to convert my application which is written in VB.NET to C# because the project I am working on currently is being written in C#. I tried my best to convert it, but somehow the app does not work. I am also not getting any errors when I complie thus, letting me know I am on the write track. Basically what I want to do is edit,add,delete, and update an XML file in a DataGrid. Below...
4
2880
by: a.frank81 | last post by:
I have problems with this Code: Public Sub SetPropertyValue(ByVal strPropertyPath As String, ByVal obj As Object, ByVal Value As Object) ..... Dim t_PropertyInfos() As System.Reflection.PropertyInfo = (t_obj.GetType).GetProperties For ii = 0 To t_PropertyInfos.Length - 1 If t_PropertyInfos(ii).Name = t_strProperty Then t_PropertyInfos(ii).SetValue(t_obj, Value, Nothing)
10
4970
by: cmdolcet69 | last post by:
Public ArrList As New ArrayList Public bitvalue As Byte() Public Sub addvalues() Dim index As Integer ArrList.Add(100) ArrList.Add(200) ArrList.Add(300) ArrList.Add(400) ArrList.Add(500)
3
3965
by: Hvid Hat | last post by:
Hi I want to highlight (make it bold) a word in some text I'm getting in XML format. My plan was to replace the word with a bold (or span) tag with the word within the tag. I've found the code below and it works fine as long as I'm not adding tags around the to parameter. Can anyone explain to me why it doesn't work with tags? And it needs to be XSLT 1.0. This works: X<xsl:value-of select="'little steak'"/>X This doesn't work:...
15
2369
by: Steve | last post by:
I am having problems getting values out of an array. The array is set as a global array and values are pushed into it as they are read from a JSON file using a "for loop". When the "for loop" is finished I want to convert the array into a string which can be used by another function. My attempt to do this is not working. The script looks like this: heights=; function getElevationInter(latv,lngv) { var script =...
0
2880
by: =?Utf-8?B?cm9uZSBtYXRpYXM=?= | last post by:
I have the same task to do but everytime I tried to parse my code I get a null value returned after executing "dtMaterials.WriteXml(swMaterials);". I am using the following code: Hope you can hep me out with this. Thanks. DataTable dtMaterials = new DataTable(); StringWriter swMaterials = new StringWriter(); swMaterials = null; string strMaterials = string.Empty;
12
1561
by: Miro | last post by:
How can I convert this part of the line: Me.dgvmyData.Columns.Item("txtCellName") ' "txtCellName" which is within this line - Me.dgvmyData.Sort(Me.dgvmyData.Columns.Item("txtCellName"), System.ComponentModel.ListSortDirection.Ascending) To read something like: Me.dgvmyData.Columns.Item( nonQuotedVariable ) So I do not have to use a "String" variable to specify the column name.
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10252
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10231
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9073
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.