Opening A Series Of Text Files, With Variable Names...
Hi all,
I am trying to add a function to a program - here's what I need it to do:
Open a series of txt files, bringing the content into a listbox. I am quite competent at opening and importing one file, but I need to be able to open how ever many txt files appear in a certain folder.
To make it more complicated, each txt file is date stamped, so every one will be different.
Looking at the proposition I see the following:
1. Check the particular folder to see what files are in there 2. Open the first one and read in the details into a listbox 3. Open the second one... etc
I've not come across this one before, so can anyone offer any advice on how to approach it?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Opening A Series Of Text Files Automatically...
Hi all,
I am trying to add a function to a program - here's what I need it to do:
Open a series of txt files, bringing the content into a listbox. I am quite competent at opening and importing one file, but I need to be able to open how ever many txt files appear in a certain folder.
To make it more complicated, each txt file is date stamped, so every one will be different.
Looking at the proposition I see the following:
1. Check the particular folder to see what files are in there
2. Open the first one and read in the details into a listbox
3. Open the second one...
etc
I've not come across this one before, so can anyone offer any advice on how to approach it?
Use Text From INI File As Variable Names
Somebody help!
I need to dynamically create variables from the variable names and their values stored in an INI file, essentially. There are about 250 of them to create and I don't want all that to be static in my prog...not good programming.
Here is a sample from the settings file:
...
USER_NAME=UserName
USER_FNAME=FirstName
USER_LNAME=LastName
USER_PASSWORD=Password
USER_EMAIL=EmailName
USER_ID=EmployeeID
USER_PM=ProjectManager
USER_PE=ProjectEngineer
USER_PENDING=Pending
USER_DATE=Date
USER_DATENEEDED=DateNeeded
USER_JOB=Job
USER_COMMENTS=Comments
...
Where basically I need to do this
Code:Dim USER_NAME As String
USER_NAME = "UserName"
Thanks,
VBsixer
p.s. I know how to use the GetPrivateProfileSection, GetPrivateProfileString, WritePrivateProfileString stuff. It's not that. If you need more info, please post.
Chart Series Names
The macro below works fine to automatically place the designated number of plots on the same chart, but only if the line:
Code:
ActiveChart.SeriesCollection(M).Name = "=""Name " & M & ""
is disabled. When enabled a message appears that states "Unable to set Name property in series class".
Any suggestions for syntax?
Code:
Dim Q As Integer
Dim M As Integer
Dim L As Integer
Dim J As Integer
Charts.Add
ActiveChart.ChartType = xlXYScatterSmooth
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1")
Q = 2
L = 6
J = 8
For M = 1 To Q
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(M).XValues = "=Sheet1!R[" & L - 1 & "]C4:R[" & J - 1 & "]C4"
ActiveChart.SeriesCollection(M).Values = "=Sheet1!R[" & L - 1 & "]C5:R[" & J - 1 & "]C5"
ActiveChart.SeriesCollection(M).Name = "=""Name " & M & ""
L = L + 4
J = J + 4
Next M
Opening Txt Files With A Variable
How would i open a .txt file in VB using a variable
for instance at the moment i have:
<VB> Open "text.txt" for Input as 1 </VB>
but this only opens a file that is named text.txt, what if i had a variable like "name" which can change according so selections by the user
So i want to be able to open a file "name"
but open the file that "name" is equal to, not a file called "name"
so if name = text1
I want to use "name" to open a file that is text1.txt
Getting Series Collection Names In Ecxel Chart
Is it possible to code to get the series names in a chart that is already made? Or do have to make some sort of form with stuff on it to allow the user to set that up? Im looking to not hard code what columns data is pulled for the charts, I want the user to define them because different data is required for different items.
Thanks,
Tom
Importing Text Files With Random Names
Hi Guys,
Thanks in advance for your help. Here is my problem:
A client of mine needs a report be be printed from a text file that is generated from a big grind roller machine. The text file that is created is named by the roller according to the date and time it was created.
an example of the file is: 15112006033131.grecord obviously this file was created on 15/11/2006 at 03:31.31 the .grecord word is always the same.
an example of its contents is as follows:
operator=mp
crew=c
shift=1
startdate=15/11/2006
stopdate=15/11/2006
starttime=02:46:11
stoptime=03:29:16
roll_id_act=c767
pregrindd1=569.174
pregrindd34=569.239
pregrindd6=569.157
postgrindd1=568.938
postgrindd34=569.014
postgrindd6=568.953
totalremovedd1=0.236
totalremovedd34=0.225
totalremovedd6=0.204
wh_wear=690.631
pregrindcr=0.082
postgrindcr=0.068
pregrindtap=-0.017
postgrindtap=0.015
stand_act=3
machine_nr=2
vollmerpath=y:\vollmer[15 11 2006]c767
lismarpath=y:\lismar[15 11 2006]c767
ra1=.44
ra2=
ra3=
rollstatus=matched
matchno=c768
outgoingcondition=ok
ra4=
ra5=
ra6=
crackdetection=1.000
cracktestno=1
crackpassed=1.000
ultrasonic=0.000
pregrindh1=
pregrindh2=
pregrindh3=
pregrindh4=
pregrindh5=
pregrindh6=
postgrindh1=
postgrindh2=
postgrindh3=
postgrindh4=
postgrindh5=
postgrindh6=
The file is placed in the same directory each time.
Ok, so this is the situation:
I dont need all the values, i just need some of them. for example, i neeed operator, startdate, roll_id_act and some other values. Once I have optained the values, they have to be displayed on a report, the values saved in a database and the original text file deleted.
The main sticking point for me is how to get the data from the text files because they are a random file name. All the other examples i have seen when importing text files is assuming you know the name.
the other question I have is how hard will it be to import the data in the format that the text files are in (value_name=data). is it easy to import text files in this format?
Cheers,
Trav
Creating ScatterCharts Where The No. Of Series Is Variable?
I have data like this
Code:
135.3 003 042 [BlankColumn] [BlankColumn] 200.3 004 043 [BlankColumn] [BlankColumn]
545.4 034 042 305.6 056 043
787.4 055 042 499.5 101 043
...
...
...
Data is arranged in clusters of 3 columns with 2 blank columns between them. In each cluster, the first column should be on the X-axis, the second column on the Y-axis and the third column should be the series name (as you can see it does not change for each section of data). The problem is that the number of such clusters (or sections) is variable.
Now I tried using a counter variable 'i' in the following code snippet:
Code:
Sub Charting()
Numrecords = 7 'this is the number of 'clusters' or sections of data; each section will contribute one series on the chart
Range("DA1").Select 'because if I select a cell which has data around it, excel automatically assumes the source data ranges, ALWAYS incorrectly, then I have to manually delete the series and add my own custom series'.
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.Location Where:=xlLocationAsNewSheet
ActiveChart.Name = "Chart1"
Sheets("Processed").Select
Range("A3").Select 'because this is where the data starts from
For i = 1 To Numrecords
ActiveChart.SeriesCollection(i).Name = ActiveCell.Offset(0, 2)
ActiveChart.SeriesCollection(i).XValues = Range(ActiveCell, ActiveCell.End(xlDown))
ActiveChart.SeriesCollection(i).Values = Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(0, 1).End(xlDown))
ActiveCell.Offset(0, 5).Select 'to move to the next section of data
If ActiveCell = "" Then Exit For
ActiveChart.SeriesCollection.NewSeries 'add a series if data is present
Next i
End Sub
But I get 'Runtime Error '91': Object variable or With block variable not set. I tried replacing ActiveChart.xxxxxx in the 'For...Next' loop by Chart("Chart1").xxxxx but it does not work either! Can someone help?
Notes:
1. Using Excel 2007.
Excel, VBA, FTP And Text Files With Semi-random Names
Ok, here's the deal:
I've been saddled with some reporting duties, and as I'm also the local geek, I don't have time to muck around. Unfortunately, when it comes to coding I'm a data wrangler, not a code poet, so I need some help.
Our mainframe produces text files (normally tab delimited) that I need to pull into an excel sheet. Right now, I ftp in, download the file, rename it to "data.txt" on my desktop, and then my code runs and formats the reports... but I have to do this one at a time for the dozen or so I run every month right now (and more to come... many more).
What I'd like to do is have Excel/VBA do the legwork for me, by going to the FTP site and pulling the text file into a spreadsheet for me. The "how' is what has me stuck. Right now I juse use Workbooks.Opentext with the file location preprogrammed in. I'm pretty sure there is a way to slap the FTP site in there, it's the parsing of the directory to get the correct filename that has me stumped.
The site can be accessed with ftp://USER:PASSWORD@ADDRESS/
There are a few exceptions to the filenames, but the big one I need to pull is called "XXXXXX_SUMM_YYYYYY.MMM ", where X is a random number string, Y is the account number, and MMM is the month.
Ideally I'd have a form with a button for each account number, and a click would search the FTP site (files are all in only one directory) for a file with that account number (YYYYYY), plunks that full filename into the OpenText command, and slaps the data in that text file into a spreadsheet.
I hope that wasn't too rambly. Definately appreciate any help ya'll can give! And I apologize in advance for how easy the answer undoubtedly is.
*RESOLVED* Using Text File As String Input For Opening Other Text Files
OK, I've been banging my head trying to get this one little piece to work (that I had working prior to a loss of power on Friday) but I cant remember the syntax I used to get it right.
What I'm doing is opening 1 text file and using it as the input in a loop to open and parse mutiple text files to a text box.
Heres the part that doesn't work;
Code:
Open "rbt.txt" For Input As 1
Do Until EOF(1)
Open " " & rbt.txt & ".txt" For Input As 2 'THIS IS THE PART THATS not working !
Line Input #2, slist
s = s & slist & vbCrLf
Upt_log_txt.Text = s
Loop
I know its a syntax (read as placement) issue but I cant get the right combo down.
HELP !
Newbie-Opening And Saving Text Files In Text Boxes
I'm trying to find a way to save text from a text box as a .txt file or .rtf and then be able to retrieve files of similar type and open them in a text box on my program. There must be a way to do this, I'm just not able to figure it out. Help?
Loading Names Of Files Into A Data Base Or Text File
I need to put to gether a program for mangeing data at work. I need to know how to look in a directory and load the names of the files in it to either text file or preferbly a data base file. I need the code and explicet instructions on how to use the code(I'm still trying to get used to VB)
Opening Files In A Text Box
I am new at VB, so this may be a very basic question. I can open up a .txt file into my VB application that I am creating, however, I can't see it in my text box. How do you link the file that I open with a text editor?
Here is my subroutine for the "open" button:
Private Sub Open_Click()
CommonDialog1.Filter = "Assembly Code (*.ASM)|*.ASM|Text Files (*.TXT)|*.TXT|All Files (*.*)|*.*"
CommonDialog1.FilterIndex = 1
CommonDialog1.ShowOpen
openWhatFile = CommonDialog1.FileName
End Sub
Basically, I want to place the contents of "openWhatFile" into a text box...any thoughts?
Thanks,
Bill
Help Opening Text Files...
So if someone double clicks on a text file, it opens in Notepad or whatever there default text editor is, how do I do that for my application? Can someone set me in the right direction? I have a File>Open thingy that works, so can I use that somehow?
Cheers.
Opening Text Files
I can't get this code to open a text file and just store a whole line into a string and print into a textbox the way it is stored, even after trying some code I found in searching. Also, is there any reason why my filter doesn't filter?
VB Code:
With CommonDialog .Filter = "Plain Text Files (*.txt) | *.txt | All files (*.*) | *.*" .InitDir = "C:" .ShowOpenEnd With ff = FreeFile Open CommonDialog.FileName For Input As #ff Do While Not EOF(ff) Line Input #ff, lin(a) txtText.Text = txtText.Text + lin(a) a = a + 1Loop Close #ff
Opening Text Files
How to check whether a text file is open or not from vb6.0 before opening the text file?
Thanx in Advance....
Opening Non-text Files
I am trying to read an entire non-text file but for some reason when using
Open Path For Input As #1
Do Until EOF(1)
Line Input #1, strData
mrfile = mrfile & strdata
Loop
Close #1
...etc, for some reason it only reads in the very begining of the file.
Any ideas? I (have been testing a .rar file). TY.
Opening Text Files
For my program:
I can save a text file and i can load the open dialog but I can't have the data show up in my textbox.. So if i were to save the textbox then close it.. Then open it, i would have a blank textbox.. Can anyone help?
Opening Text Files
Could anyone please tell me what is the quickest way to open a text-file and get the contents into a textbox?
I have tried to open it sequential and read it line by line, or character by character, but it takes so much memory and time, I can only open small files (<10 kB)
Is there a way to open the whole file at once?
------------------
Wilhelm Tunemyr,
Sweden
wilhelm.tunemyr@swipnet.se
"Dort, wo man Bücher verbrennt, verbrennt man am Ende auch Menchen"
Heinrich Heine (1797-1856)
Pravda zvítezi!
Text Files Opening
Jessie,
Not quite sure how you want to do the interface for your files. But have a look at the dir, filelist, etc controls. I use these in a number of projects where the user can select from mutiple files for data extraction, i.e SalesJan, SalesFeb,...Sales1999 etc. Am currently looking at replacing this with a combo list box from which the user can select a file
Hope it helps
Text Files Opening
Jessie,
Not quite sure how you want to do the interface for your files. But have a look at the dir, filelist, etc controls. I use these in a number of projects where the user can select from mutiple files for data extraction, i.e SalesJan, SalesFeb,...Sales1999 etc. Am currently looking at replacing this with a combo list box from which the user can select a file
Hope it helps
Opening Big Text Files Less Than 2MB
Hi ,
I open one text file and put it into a textbox (in order to do text processing )successfully but when this file is big (but less than 2MB) I am not successful what can I do?Is there a better control than textbox?
thanks
Edited by - AbbydonKrafts on 1/31/2007 7:09:36 AM
Opening Text Files In VB 5/6
I need to open text files in VB and pull the information out of it in chunks to
pass to an Access 97 database. I have suffecient documentation on the ADO portion of the operation, but I cannot get the text file to load properly. When I load the file in and diaply it in a test box, it shows up as one line, with the Chr(10) and Chr(13) as horizontal bars. Can someone give me info on how to solve this problem, plus perhaps some pointers on the best way to seperat the data? I have to do this for 1,268 text files, and even if I have to kick each off individually, that's OK, I just need help with the breaking up of the data into the appropriate sections.
Any help would be greatly appreciated!
Bob
Opening Unix Text Files
I've got a text file which is read in line-by-line and processed. However, some text files, which show up as type 'Unix' in UltraEdit, don't work with Line Input. I think that these files only contain a LF at the end of the line, not a CR/LF combo which a 'DOS' file has.
Is there a way to change Line Input so that it only needs a LF for a new line, not a CR/LF combo?
If Line Input can't be changed, I was thinking of going through the text file character-by-character, and adding in the missing CR's or LF's so that Line Input will then work.
Alternatively, I was also thinking of reading in the entire file using Input(), then using split() on CHR(10) to separate out the lines. Has anyone got any ideas on which might be faster / less memory hungry?
Thanks,
David
Opening Files To Text Boxes
how would you open a file form notepad to fill the textboxes with what you have in the notepad file. so if i had Winner on one like and Dinner on a nother line i wan't them to go into diffrent text boxes from notepad. thanks, please help!
Opening Web-based Text Files
Has anyone ever had any experiencewith opening web-based text/html files with ASP. Not ASP.NET I hasten to add.
Basic premise is this. A client wants a news ticker on his site. I have access to a text file that is loaded on a web server. What I want to do is grab the contents of that text file, parse out the stuff I need, create a text string that I can subsequently load into a javascript object which will merrily scroll along with the latest news.
My problem lies solely with opening a file that is not stored locally. Can someone please help.
I understand that it can be done using FTP objects, but surely ASP has some functionality that will allow me to open a remotely located file.... (PHP does - one line!!!!!!!!!)
Thanks in advance
Opening Text Files From Directorys.
Hello,
I'm making a little program that opens text files into a datagrid and does some calculations etc. I've managed to get everything working apart from one thing. I can't manage to figure out how to open a text file based on when it was created. Just now I have been specifying an exact filename to get the datagrid stuff and calculations working. Now, I want to load text file into the datagrid from a search based on the date modified or part of a filename. i.e. I was loading a file like this before, from a specific directory, like my documents
testfile-2008.04.26 17540.txt,
Now I'd like to search for something like "testfile" in a specific directory like my documents, and it would load the most recently modified. Any help appreciated!
Cheers.
Opening Over 100 Files And Changing Certain Text?
I was wondering if its possible to make a program that'll open every file thats in a folder (file type is htm) and changing certain text in it? Also if it would be possible to changing some code in the file that is multi lined?
Error Opening Text Files
Hi, I have a GUI with a button and a textbox. And when I press open, it should open up the text file which I chose. It works fine until I tried to open up a text file with a , on the last line of the text. It will generate an error 62, past end of file. Is there any modifications I can do to my code to solve this problem because most of the textfiles I open have a , at the last line, therefore, if this problem is not solve, my GUI will not serve its purpose. Thanks.
The code for the button is:
VB Code:
Private Sub cmdShowOpen_Click() On Error GoTo errHandler With CommonDialog1 .Filter = "Text (*.txt)|*.txt" .InitDir = "C:Program FilesMy Files" .ShowOpen If Len(.FileName) Then Open .FileName For Input As #1 txtLog.Text = Input$(LOF(1), #1) Close #1 End If End With Exit SuberrHandler: MsgBox Err.Number & " " & Err.Description End Sub
Opening Rich Text Files In VB
hi,
i want to do a search and replace operations on rich text files, but im not sure which functions to use.
currently , i am trying to use FileSystemObject, but not sure whether it reads one word at a time or not.
i want to know what are my options.
thanks.
regards,
zuber
Opening And Reading Text Files
Hi, I am new to Visual Basic 6.0, but currently as required, I have to use it to do a small part for my project. The GUI consist of a button called open and a textbox. When a user press on the open button, it will show a list down box (common dialog) of the text files in the C: drive or the whole drive and let the user select the text file. When the user has select a text file to open, and he/she has press the open button, the text file's content will show in the textbox. Does anyone has a code or solution for it? Any help will be greatly appreciated, Thanks.
Opening Text Files For Reading
Hi,
I am opening a text file so I can read the text as below,
sFile = "Cross_Reference.INC"
lFile = FreeFile
Open sFile For Input As #lFile
Do While Not EOF(lFile)
ect...
Now the problem is that the text file will always have the .INC extension but not always the same name. There will only ever be one .INC file in the directory so how can I tell the file name to load it as wild cards not not work.
thanks
joolz
Problem Opening Text Files
Ok, i'm opening this text file with the Open for input method.
VB Code:
Open CommonDialog1.FileName For Input As #1 Do While Not EOF(1) Input #1, TheText If MyForm1.Text1 = "" Then MyForm1.Text1 = TheText Else MyForm1.Text1 = MyForm1.Text1 & vbCrLf & TheText End If Loop Close #1
The 1st line in the text file is:
(_.-={ This is The First Line!! }=-._)
Now the problem is when this code runs, that line is opened as 3 lines. It looks like it stops by peirods or something. It looks like this:
(_
.-={ This is The First Line!! }=-.
_)
Can anyone tell me why?
Opening My Text Files...My Nightmare
Can u find out why I get the error
"Input past the End of File" ?
Code:
For count = 1 To 5
stFile = stDir & "Aq" & count & ".txt"
Open stFile For Append As #1
Print #1, strCopyWright
Close #1
Open stFile For Input As #1
strText = Input(LOF(1), 1)
Close #1
strText = Left(strText, Len(strText) - 1) & "?"
Open stFile For Output As #1
Print #1, strText
Close #1
Next
Opening .DOc Files And Putting Text Into RTF Control
I'm making a little app based on a RTF control, and I want to user to be able to save files ready for editing as RTF, but they need to originally open them as .DOC, putting the contents into an RTF control. Currently I do this to open files:
VB Code:
Private Sub Opener()CommonDialog1.ShowOpen richText.LoadFile CommonDialog1.FilenameEnd Sub
This works fine for Word and Text files, but how can I adjust it for .doc files? (Or even more complex, docx files - new Office 2007 format so my app will be future proof)
Thanks
Opening Text Files Located On The Internet
I'm not sure if it's possible, but does anyone know how to open a text file for input that is found on the internet (e.g: "www.domain.com/textfile.txt")
Or do I need to download the file in the app and then read it? If so how?
Thanks
Variable Array And Text Files
I need to create a loop to read each line of an text file and store each line in a different variable. I know I should use an array but I'm not even getting close to getting one working.
I've tstarted with:
Open DirProj.Path & "" & "PTSC-S.txt" For Input As #1
Do Until EOF(1)
Line Input #1, lineoftext(Index)
Loop
Any help?
Thanks,
Bernie
Extracting Text From Lines In Files - And Opening .url Shortcuts
Ok, using vb6 I am trying to Open a .url file with my program. I dont know how to "load" the file into the browser window like you would say a text document into a RTF ,,,
Or, i thought, if I loaded the .url as text and pulled out the http:// from some type of ini command, and simply "navigate" the text output.
(To explain the .url shortcut, it basically has a section named [internet shortcut] and then an intry called url= and then the HTTP name. I would need to output the text after the url= part)
So how could I either load a .url shortcut into the app, or pull the text out of the .url ? Is there another way ? Please help :-)
Thank you very much for your time, as Your efforts have built the modern computing world. Sincerly,
BaLLZaCH
Opening All Text Files In A Directory And Manipulating Data
Hi guys,
I have a problem which has been confounding me for a long time, and i am too inexperienced at VB to solve it.
I have a lot of txt files under 1 directory that needs to be analysed.
Each text file consists of about 70000 data points all in 1 column and i would like to do a simple averaging of 3 data points to make it into 70000/3 data points.
Then i would like to export this new averaged data obtained into seperate txt files into another directory with the same name as the one before with a slight modification in the name like something added to the back.
eg. C:Old DirectoryCLII.txt to C:Another DirectoryCLII Avg.txt
Can anyone be kind enough to help me out?
Thanks !
Simple Question Regarding Opening/finding/saving Data In Text Files.
Okay here's the scenario:
I have two big lists of numbers. One number on each line (they're telephone
numbers if that helps.) What I want to do, is have VB search through
list2.txt for numbers that are also in list1.txt and delete them. I would
usually sit and figure this out myself but I have the flu and I know how
helpfull you guys are :P~
Thanks in advance to anyone that can help.
-Ben-
Write Series Of Strings To A Text File
I was trying to write lines like this:
string1,string2,string3...
But the problem is that with the Write method, the file is set like this:
"string1","string2","string3"...
I haven't found a way to remove them from there, any ideas?
Thanks,
Variable Names
i posted this in the VBA section but this can also be applied to General problems... keep in mind that i am using VBA (ie i can't use index values)
OK, here is my problem: i have a form with 100 tetboxes in 10 rows and ten columns. In a previous form the user decides how many rows and columns he/she wants to have visible. The text boxes are named based on their position in the row/column. ie MM23 would be a textbox in the second column and third row. How can i use a counted loop to reference these textboxes and make the appropriate ones not visible? is there a way to use a variable in the name of the textbox? or some way of using callbyname?
ANY and all help is greatly appreciated
CN
Variable Names
Hi
I want to use the variable "currentArray". it will be set as either "numbr" or "memA" how can I use this, say in the following way:
currentArray & "sign" ="+"
so that hopefully i would get either
numbrsign = "+"
or
memAsign = "+"
so that depending on currentArray it either changes one of 2 variables,
Thanks
HR
Variable Names
Hi,
I've got a application were there are several text boxes, labelled text1, text2, text3 etc.
No what I want to do is populate these text boxes within a loop so that I don't have to repeat the same code.
Is there way in vb to to contruct the name of a variable (eg. text1) with a loop. I tried doing the following but it obviously made no sense (this is a example):
for i = 1 To 10 Step 1
"text" + i = "this box" + i
next i
If you know what I'm trying to do, could please help me out.
Thank You!
Variable Names
What is the maximum length that I can give a variable in vb?
What happens if I exceed this length?
$ And && In Variable Names
Does this have some special significance? Is it shorthand for string?
Like in something like this:
VB Code:
Function FileExists(sFileName$) As BooleanOn Error Resume Next FileExists = IIf(Dir(Trim(sFileName)) <> "", True, False) End Function
What about "&"?
thx
Variable Names...
Hey All,
Is there a way to reference a variable name using a string? Here is an example:
I have a class with many variables labeled as follows:
Code:
ClassName.L2B1Offset
ClassName.L2B2Offset
ClassName.L2B3Offset
.
.
.
ClassName.L2B10Offset
Is there a way I could loop through the variable names and change the number in the variable name? For example:
Code:
For i = 1 to 10
ClassName.L2B & i & Offset = SomeVariableValue
Next
I know this approch won't work but is there some way to accomplish the same thing??
Cyphin
~Of all the things I've lost, I miss my mind the most.~
~Iz vseh veshei chto ya poteryal, ya bol'she vsego skuchayu po rassudku.~
Help With Variable Names
simple code.
All i want it is to have bob say hi when you click button 0
and have frank say hi when you click button 1
both doen't work
{
Private Sub hello_Click(Index As Integer)
If Index = 0 Then
name = bob
ElseIf Index = 1 Then
name = frank
End If
Dim hello As New name
hello.hi
}
or
{
if index = 0 then
dim hello as new bob
end if
if index = 1 then
dim hello as new frank
end if
hello.hi
}
it works if i do a
{
dim hello1 as new bob
dim hello2 as new frank
hello1.hi
hello2.hi
}
but i need to have both of them be hello.hi
any help?
Retriving Variable Names
Hi,
Does anyone know of a method to retrieve Variable names from within a module/procedure/function etc (Im hoping for a similar method that you can use to retreive objects on a form)
Cheers in advance for any pointers in the right direction.
|