Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How To Put A Text File Content In A Public String???!!!!


Hi

I have a text file (nearly 3.6 MB)..

I must use it at anytime in my project (all forms..)

So I must read it to one string (public for all at any time).. not to read it every time I want it..

So how to do it with VB6??


It is an urgent problem please!!!


Thanks alot..




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Put A Text File Content In A Public String???!!!!
Hi

I have a text file (nearly 3.6 MB)..

I must use it at anytime in my project (all forms..)

So I must read it to one string (public for all at any time).. not to read it every time I want it..

So how to do it with VB6??


It is an urgent problem please!!!


Thanks alot..

Parsing Content Of Text Boxes To Crystal Report Writer - Public Variables
Dear Expert,

I'm parsing contents of text boxes on a form to crystal report writer.

These text boxes don't write to any datatables.

What is the approriate syntax to send say


1. a numeric figure

2. a name


straight from the form to crystal report writer without saving into a datafile.


Thanks

How To Tell Whether An RTF String Has Text Content
I need to be able to tell whether a given string consisting of RTF contains actual text. Obviously, len(anRTFString) won't work. Any ideas?

Picture Boxes Text Content To String
I'm currently writing a program where i need all the text in a picture box and make it a string (or other varible if possible) ... is this at all possible.. if so please help

Mojoinst

Displaying Text File Content In A Datagrid Then Open That Text File...
I have a form named frmTest and contains a datagrid called dgData and two buttons. One is button 'Read text file' and the other one is 'open text file'. I also have a class module named CReadFile. and a textfile named test.txt

The code for button Read text file is:

Code:
Private Sub cmdReadTXT_Click()
Dim obj As CReadFile
Set obj = New CReadFile

Set dgData.DataSource = obj.Read_Text_File
Set obj = Nothing
End Sub
and the code for the open text file button is:

Code:
Open "test.txt" For Input As 1
MsgBox "file opened."
Close
The code inside the class module is:

Code:
Option Explicit

Public Function Read_Text_File() As ADODB.Recordset
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.Open "DRIVER={Microsoft Text Driver (*.txt; *.csv)};" & _
"DBQ=" & App.Path & ";", "", ""

rs.Open "select * from [test#txt]", conn, adOpenStatic, _
adLockReadOnly, adCmdText
Set Read_Text_File = rs
Set rs = Nothing
Set conn = Nothing
End Function
_____________

This is what happens, if you click the button 'Read text file', the contents of the text file will be displayed in the data grid. After clicking the button 'Read text file', I now want to click the button 'Open text file' to open the text file, but an error appears saying: Run time error '70': Permission Denied.
Why is that so? What should I do to solve this problem? I need to open that file again for validation after displaying the contents.

Thank you.

Converting The Content Of The Text File To The Original File
Hi,

Here's the situation
-Let say I have a file called "Test.zip"
-then I change the extension name to .txt to convert it to text file
-of course when you open it you'll see symbols and other unknown characters
- here's the question:
Is it possible to read that uncommon content of the text file to retain or convert it back to it's original form ( in this case to .zip file)

can someone show me how it's done?

Is It Possible To Load A .txt File's Content Into A Text Box?
... well?

I have a .txt file with 1,021 characters that I need to display in a form, is there anyway to do this?

HELP: View Text File's Content By VB
Please show me how can I view content of text file (i.e logfiles *.txt) by using VB code?

Thaks

How To Download Content Of Text File Without Ocx
How to download content of text file without ocx

I was find some module in planet-source-code, but it have bug ex: over memory when url invalid

help me, thank you very much!

Transfer Text File Content
Hi everyone, can someone show me a code how to transfer content of a text file to another text file?

one text file named A.text i want to open using "For Open" and another one (B.text) using "For Append"..so i want everything in A.text transfer to B.text

Modifying Content In Text File
Hi,

I have a text file "orig.txt" with the content:

0:NV0067:8:BV1:Normal:66.103.203.35
0:NV0067:9:BV2:Normal:66.103.203.36
0:NV0067:10:BV3:Normal:66.103.203.37
0:NV0067:11:BV4:Normal:66.103.203.38
0:NV0067:12:BV5:Normal:66.103.203.39
0:NV0067:13:BV6:Normal:66.103.203.40


I need help in making a vb program that will modify the content in "orig.txt" to this format and save it as modified.txt:
66.103.203.35 X-NV0067-BV1
66.103.203.36 X-NV0067-BV2
66.103.203.37 X-NV0067-BV3
66.103.203.38 X-NV0067-BV4
66.103.203.39 X-NV0067-BV5
66.103.203.40 X-NV0067-BV6

at the end, delete "orig.txt" file.


Any help would be appreciated. thanks!

Content Directory In Text File
Hi
I want to write on a file the names of there files in a directory using visual basic.
Can i do?

bye bye
Silvia

Filtering Out Content From A Text File
I am using the following code to open a text file that contains URLs, I want to "filter" out only the lines/words that start with http https cookie etc and show only the relevant text

how would i modify my dode to do this?

Dim strInput As String
Private Sub Command1_Click()

Open "C: ext.dat" For Input As #1

Do Until EOF(1)

Input #1, strInput

RichTextBox1.Text = RichTextBox1.Text & strInput

Loop

Close #1

End Sub

Getting Content From Text File To Listbot
Like the title stated, I would like to know how I can save the items in a list box to a text file, then retrieve it when needed. I'm going to have names that are going to be added to the listbox and I didn't want to add the items manually everytime i ran the program. Thanks.

Copy Content Of A Text File To Another
How can i copy the content of a text file to another already existing textfile? This copy must first delete the content of the file it writes to.
i.e.

content of file1:

1234567890

content of file2:

aaaaaaaaa

result must be:
erase content of file 2 (aaaaaaaaa) and replace by content of file 1=1234567890

file2=

1234567890

Put Content Of Listbox In A Text File
How can I put the content of a listbox in a text(ascii) file?

Saving The Content Of A Text Box Into A File
i want to have it so when you press a button it saves whatever is in the text box to a file and then if there is a file existing when you open the program again it will load the text from the file into the text box



Edited by - Split on 12/10/2005 1:12:17 PM

How To Sort The Content Of A Text File
hi,

Is it possible to sort the content present inside the text file.?

pls give some idea

thanks and regards

Suresh

CSP And Public Key Crypto Systems / Parsing Webpages For Content
First of all a big thankyou to all you guys that have helped me get this far...
Anyone who's answered a question will get a free copy of this software when it finally comes out...

BUT heres a biggy!!!

how can i use the cryptAPI for public / private key encryption? if i create a public private key pair using openssl (yay for linux) i want to be able to parse the content of a page (encoded text) from the webbrowser control (how?), store it to the registry (this i can do) and use a private key and cryptAPI to unencrypt it (not sure about this one, although i have seen a good start in Barry Dunne's modcrypt).

to recap...
1) how can i parse the text from a page displayed in the webbrowser control? (oh, i suppose i could saveas, and then parse in the usual manner!!!)
2) how do i pass a private key to cryptAPI to unencrypt it?
3) what is the relevent command in openssl to create a compatible public / private key pair, and encrypt it (oh i'm so lazy...)

Regards, James.

Sort Text File Content. Ideas Please :D
Hi ppl.

i have a text file look like this:

Code:
t155.4 ;B277i ;t.3918 ; ; ;
t155.4 ;B277i ;t.3917 ; ; ;
t371.102019 ;M672v ;t.3945 ; ; ;
t371.102019 ;M672v ;t.3946 ; ; ;
m347.952 ;A511e ;t.19409 ; ; ;
m331.88(81) ;P436c ;t.19396 ; ; ;
m347.955 ;P436r ;t.19362 ; ; ;
m34:502.7 ;V855r ;t.19338 ; ; ;
m347.77 ;A779p ;t.19358 ; ; ;
m347.919.3 ;O48j ;t.19373 ; ; ;
and i need to sort him in ALPHABETICAL order, using 2nd column (separated by ; ) to make a sort. i have to 'transform' my text file in something exactly like this:

Code:
m347.77 ;A779p ;t.19358 ; ; ;
m347.952 ;A511e ;t.19409 ; ; ;
t155.4 ;B277i ;t.3917 ; ; ;
t155.4 ;B277i ;t.3918 ; ; ;
t371.102019 ;M672v ;t.3945 ; ; ;
t371.102019 ;M672v ;t.3946 ; ; ;
m347.919.3 ;O48j ;t.19373 ; ; ;
m331.88(81) ;P436c ;t.19396 ; ; ;
m347.955 ;P436r ;t.19362 ; ; ;
m34:502.7 ;V855r ;t.19338 ; ; ;
ps: i already open, read and works with file contents normally. i just want sort content of file using 2nd column.
anybody can help me ?

How To Save Listbox Content To A Text File
Hi,
I need to write the data in a list box to a text file by creating the text file.

whenever the list box receives a data it should save the data to the text file.

Next time when the data comes to the list box it should get appended with the existing text present in the file.

how can i do that in VB?

I am new to VB...
Expecting reply

thanks in advance

Reading A Text File And Overwriting The Content
greetings vb experts. i just want to ask, what's the code for opening a text file, and overwriting its content. as i remem it has commands such as,

open file #.... (and so on)

can you pls help me... thank you so much

Showing The Content Of Notepad File In A Text Box Control
Hi all,

Hope all in fine tune. Here I am uploading a text file. What all I need is that I want to show the content of the file in text box control of a form with multiline set to true and scroll bars to both. But the contents are coming in the control but are compressed to a new line and the alignments are going off. My requirement is to show the contents exactly in the same way as it appears in the notepad file when maximized.Please help me as a project is withheld for this code.

Help me Plzzzzzzzzzzzzzzz

Thanx in advance

How To Display The Content Of Text File In The Data Report?
Hey dude,

I want to to show the content of the text file in the data report. Can you please let me know that how can show the text file stuff in the data report.

code snippets will be prefered.

Thanks I am eagerly waiting for your reply.

please. help me.

Thanks


Kamlesh Gujarathi
kamlesh@itshastra.com

Fly always to the SKY. You can do anything if you TRY. ;)

Reading The Content Of A Text File Via Line Input, Backwards!
I am using Line input to read the content of a txt file into a listbox. As each line is read in, a function is called upon to check for something. It would be very helpful if I could read the text file in reverse, so the first line is read last.

Is there a way to do this?

Thanks!

*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 !

Sorting Data From An ASCII Text String And Saving It As Text File
Hi,
I'd first like to copy paste a section of my ASCII text string over here and then ask the question.Given below is the ASCII text string:

RT 01 A_UNIT
DEV 01 A_UNIT

=ontrol Mode ON LOCAL STAT
Occupied YES OCC
CCN Chiller START CHIL_S_S
Alarm State Normal ALM
Active Demand Limit 100 % DEM_LIM
Override Modes in Effect YES MODE
=
=?
RT 01 CIRCA_AN
DEV 01 CIRCA_AN

=IRCUIT A ANALOG VALUES
Percent Total Capacity 100 % CAPA_T
Percent Available Cap. 100 % CAPA_A
Circuit Running Current 185 AMPS A_CURR
Discharge Gas Temp - A2 122.9 dF DISTMPA2
Saturated Condensing Tmp 97.5 dF TMP_SCTA
Saturated Suction Temp 41.5 dF TMP_SSTA
EXV % Open 43 % EXV_A
Variable Head Press Pct. 0 % VHPA
=
=?

Given above is a portion of my ASCII text string.I'd like to know how to sort out the data from this file and copy it in the same format as given above into a new Text File,using the delimiting characters like the white space and the "?".The "?" indicates the end of the file and the following ASCII text string after every "?" indicates the start of a new text file.

I'd be very very grateful to the person who'd give me the solution to this.Thanking you in anticipation.

String Content
Hi

This is an easy one, and I think I will be embarased when (if) I get the answer.

I've got a string of 3 fields, delimited by colons. How do I get the posibion of these colons so I can extract the fields with a MID ?

Thanks
Robert

Grabbing Text From A Text File And Saving As A String...
Hello everyone! Just a quick question...I have the following text file that I would like to grab the score from each hole, the par for each hole, the yards from each hole, the handicap from each hole, the player name, the course played, the tees played, the conditions played...basically everything as it's own string. How would I go about doing this?

Attached is the text file (it doesn't word wrap though...it does have carriage returns though):


Thanks in advance!

Dave Mosher

Find And Replace Text String In A Text File.
I have a text file - "PumpList.txt". I want to find the text string "Pump1" in this file and replace it with the string "Pump 101". I have found search and replace code examples but they all work on Text Boxes, not text files. I am having difficulty understanding how to open a text file and search for a text string and then replace it with a different string. I am using VB6. Any help would be greatly appreciated and some example code would help even more. Thank you.

Print Content Of String.
Hi again, can i ask is it possible to print my output from string's content? i tried and i am not getting the correct output.

my code looks like this;


Code:
Private Sub Form_Load()

firstfieldcount = 0
lastfieldcount = Adodc1.Recordset.Fields.Count

For looping = firstfieldcount To lastfieldcount

printstatement = printstatement + "Adodc1.Recordset(" & (looping) & ").Value; Spc(5); "

Next

Open "E:vbconvertfile2.csv" For Output As #1

Do While Not Adodc1.Recordset.EOF

Print #1, printstatement

Adodc1.Recordset.MoveNext

Loop

close #1

end sub

and my result:

Adodc1.Recordset(0).Value; Spc(5); Adodc1.Recordset(1).Value; Spc(5); Adodc1.Recordset(2).Value; Spc(5);
Adodc1.Recordset(0).Value; Spc(5); Adodc1.Recordset(1).Value; Spc(5); Adodc1.Recordset(2).Value; Spc(5);
......
......

Does anyone has better ideal of how to solve this problem?
Thank you.

Content Of A Web Page To A String
how can i get content of a web browser control into a array, string, or what ever you may

i tried webbrowser1.document.documentelement.innertext

but this aint working

Determining String Content
I need help with determing the content of a string, I need to know if it contains text or numbers. I know that there is probably some simple way to do this but my VB is a bit rusty.

Showing An Image Content Of A String
I load an image(jpeg) file to a string,here are the codes:

Dim strFile As String
lFileLength = FileLen("c:pic.jpg")
strFile = String(lFileLength, vbNullChar)
Open "c:pic.jpg" For Binary Access Read As #1
Get 1, , strFile
Close #1

for a work i like to show the picture but not with the path of the file, i like to show the content of strFile in a PictureBox or Image Control. How can i do this?
thank you

Making Variables From String Content
Is it possible to make a variable on the fly with the contents of a string? I'm making a card game and have over 100 cards. I don't want to make a generic variable called cards(1 to 100+). I would like to make them more readable so I know which card is being referred.

So lets say I have the following cards in the general declarations to make them public:

dwarf(0) = description of dwarf
dwarf(1) = power of dwarf
elf(0) = description of elf
elf(1) = power of elf
mage(0) = description of mage
mage(1) = power of mage
'and so on...

Now I have a listbox that contains all the names of the cards. In the listbox_click event, I want the card clicked on to show its description on a label caption. So it would look something like this:

---listbox---| LABEL
dwarf
elf
mage
phoenix
'and so on

When I click on any of them, it would put its description on LABEL. So if I clicked on dwarf, then the label would contain the dwarf(0) string. Now since it's over 100 cards, I don't want to be writing 100 if...then statements to do that simple thing. Get what I mean? For example:

if listbox.list = "dwarf" then label.caption = dwarf(0) 'and so on 100+ times

I've tried the following but obviously it doesn't work because either I'm doing it wrong or it isn't able to be done.

thename = listbox.list(listbox.listindex)
'not sure if that's the right syntax but I know it's something like that
'I tested it out with a msgbox to make sure I was getting the name

'now here's the part that I have the problem with
label.caption = thename(0)

'thename in this case would be dwarf and it would be the 0 index description

Having written this post now, looking at the last code line just doesn't seem right. However, do you see what I'm trying to do? If I could somehow get the listbox item name of the card and merge it with a (0) index to make a variable, I could replace 100+ lines of repetitive code with just two lines! Is this possible?

I'm using VB5. Thanks for any help you can provide.

How Can I Declare A String When Its Content Is A Table Name In SQL?
Heloo Everyone how are you today? I hope very good.

How can I declare a string when its contents is a table name. I just try something like this but the string is not recognized as a real table name in SQL, for example this code:

Dim strName as String

strName = "A"

set qry = dbs.open recordset("Select * From strName Order BY name")

What can I do to make the SQL recognize the string as a table name or recordset.

Thank everyone

Using A Public String
In a MDI project I have given the user the choice of which child form they would like to open as default and stored it in "Public openingpage as string"
How do I use this string to open the default childform when another childform closes?
I have the following but it doesn't work.
EG


Code:
frmwhatever_Unload
openingpage.Visible = True

Public XYZ(200,8) As String?
Hi,
In my Microsoft VB6 Programming Guide (Pp.118) it says you can declare an array as Public. When I try to do it, I get compile errors, and VB6 says "no Public Arrays... in VB6".

I need to share data between modules, so wonder IF I'm doing something wrong, or should I use a table?

Thanks!
Len

Help With A Public String
I have a public string declared
public makes() as string


then i load it up with values and redim it each time i add something.

for some reason the values inside are not accessible from another function.
i can see the makes(X) but its always null.
do i need to redim it as public?? is that my problem.

Ryan

Using A Public String
In a MDI project I have given the user the choice of which child form they would like to open as default and stored it in "Public openingpage as string"
How do I use this string to open the default childform when another childform closes?
I have the following but it doesn't work.
EG


Code:
frmwhatever_Unload
openingpage.Visible = True

Find Text String In Text File
I'm bringing text files into Excel, but I need to search a directory to find the right text file based on a specific text string within. I'm somewhat familiar with how to find the text string in one file, but my limited knowledge is an obstacle. I'm not sure how to search an entire directoy of files for one in particular that meets my criteria.

The source directoy is c:Source and contains many file formats, although I just want the text files searched.

The destination is C:Destination and I can save the file as ActivityList.txt.

The text string is "Activity List". Any help is much appreciated...

Finding A String Of Text In A Text File...
Hello,

I know there is a great deal of postings regarding searching and parsing a text file. However, through my searches, I have not been able to find something that is specific to what I need.

I have a text file that lists files. For example:

/myDirectory/myfile.jpg
/myDirectory/myfile.gif
#/myDirectory/myfile.bmp

What I need to do is, search for ".jpg" and grab put the filename to a text box on my form. For example the above would put the string 'myfile.jpg' to a text box. Also, I need to ignore the lines that start with the # character.

Thank you in advance.
Greg

(help)how To Read The Content Start From Certain String Of Listbox?
Hi all,

i have 2 textboxes, 2 listboxes, 1 command button.


i wish to check through the list2 to see if inside the listbox got "<>" sign, then it will list the content after "<>" to texbox1, while textbox 2 will the name with no "<>" sign

by the way, i wish to get the line number which line has "<>" sign (not in the code, because i have no idea how to get it)
for example:
List2.AddItem "= ABC10"
List2.AddItem "= ABC10"
List2.AddItem "= ABC10"
List2.AddItem "<> ABC10"
List2.AddItem "<> ABC10"

==> ACB10 the 4th and 5th in the listbox

maybe my methodology is wrong... someone pls correct me

Code:Option Explicit

Private Sub Command1_Click()
Dim i As Integer
Dim pp As Integer
Dim position As String
Dim position1 As String
For i = 0 To List2.ListCount - 1
position = InStr(List2.List(i), "<>")
For pp = 0 To List1.ListCount - 1
If position = True Then


position1 = InStr(List2.List(i), List1.List(pp))

    If position1 = True Then
        Text1.Text = Text1.Text + List1.List(pp) + vbNewLine
    End If

End If

    If position = False Then
        Text2.Text = Text2.Text + List1.List(pp) + vbNewLine
    End If
Next pp
Next i

End Sub


Private Sub Form_Load()
List1.AddItem "ABC10"
List1.AddItem "ABC20"
List1.AddItem "ABC30"
List1.AddItem "ABC40"


List2.AddItem "= ABC10"
List2.AddItem "= ABC10"
List2.AddItem "= ABC10"
List2.AddItem "<> ABC10"
List2.AddItem "<> ABC10"


List2.AddItem "= ABC20"
List2.AddItem "= ABC20"
List2.AddItem "= ABC20"
List2.AddItem "= ABC20"
List2.AddItem "<> ABC20"


List2.AddItem "= ABC30"
List2.AddItem "= ABC30"
List2.AddItem "= ABC30"
List2.AddItem "<> ABC30"
List2.AddItem "<> ABC30"


List2.AddItem "= ABC40"
List2.AddItem "= ABC40"
List2.AddItem "= ABC40"
List2.AddItem "= ABC40"
List2.AddItem "= ABC40"




End Sub


my result:
result:
textbox1 it dosplay
ABC10
ABC10
ABC20
ABC30
ABC30


while textbox2 it display
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40
ABC10
ABC20
ABC30
ABC40


above is not what i wish to get...
what i wish to get is textbox 1:
ABC10
ABC20
ABC30

textbox2
ABC40



Edited by - wtkm on 6/12/2007 8:47:19 AM

Public String Not Changing
I am having a problem with a public variable that I set not changing. It seems to work just fine on the opencmd but when I call it from another funtion it remains as the original. I am posing the code below cause I can not imagine I have explained this correctly.


Code:
Public TheFile As String


Private Sub openCMD_Click(Index As Integer)
Dim TheFile As String
CheckIt
If File1.filename = "" Then
MsgBox "please select a file"
Exit Sub
End If
If File1.Path = "C:" Then
TheFile = File1.Path + File1.filename
Else
TheFile = File1.Path + "" + File1.filename
End If
Text1.Text = FileText(TheFile)
End Sub


Function CheckIt()
Dim Rev1 As String
Dim NewOne As String
NewOne = Text1.Text
Rev1 = FileText(TheFile)
If Rev1 = NewOne Then
Exit Function
Else
MsgBox TheFile
End If

End Function
Any help would be great...

Rich

Calling A Public String
Hi im trying to create a public string in this way

General (Declarations) section

Code:
Public Playername As String

This is on form1

Then i have a textbox that is like this
Pname.text=Playername

This works fine

Now i have a command that goes to form2
and i want the same Playername to be Playername for form 2

So somewere in form2 ive got .....="C:" & Playername & ".ini"
But Playername dosent equal anything so my file is saved as ".ini" And nothing else

And also the Public declare makes an error that says
Member already exists in object module from wich the object module derives.

This happens when i compile. But i have no other Public Playername string and no module!!! So this is *** bull SH*T!

Here is my complete code for those two forms

frmnewchar1 (form1)

Code:
Public Playername As String

Private Sub cancel_Click()
frmMainmenu.Show
frmnewchar1.Hide
End Sub

'This area checks for Empty or unmatching feilds
'and brings user to the next step in acc creation
'If all requirments are met.
Private Sub cmdnext_Click()

If Playername = "" Then
Call MsgBox("Please select a character name", vbOKOnly, "Select a name")
Exit Sub
End If
If passwrd = "" Then
Call MsgBox("Please select a Password!", vbOKOnly, "No Password?")
Exit Sub
ElseIf passwrd2 <> passwrd Then
Call MsgBox("Passwords Do not match!", vbOKOnly, "Whoops!")
passwrd.Text = ""
passwrd2.Text = ""
Exit Sub
End If
'If all requirments are met.. This section proceeds

If Len(App.Path) = 3 Then 'Checks is path to save
'Text file is C:
Backslash = ""
Else
Backslash = ""
End If

DataRet1.DataFile = App.Path & Backslash & "Kanadian GamesSaving MagrothPlayer DataPlayer.txt"
DataRet1.DataFile = "c:" & Playername & ".ini"
DataRet1.GetDataValues
DataRet1.NewValueData = "Player_Name"
DataRet1.AddDataValue (Playername)
DataRet1.NewValueData = "Pass_Word"
DataRet1.AddDataValue (passwrd)
frmnewchar2.Show
frmnewchar1.Hide
End Sub

This part works fine ( if i take off the Public call at top)
Then

frmnewchar2 (Form2)


Code:
Dim Sex As String


Private Sub cmdcancel_Click()
frmnewchar1.Show
frmnewchar2.Hide
End Sub

Private Sub cmdnext_Click()


If maleopt = True Then
Sex = "Male"
Else
Sex = "Female"
End If

DataRet1.DataFile = "c:" & "Newplayer" & ".ini"
DataRet1.NewValueData = "Character_Class"
DataRet1.AddDataValue (Charclass)
DataRet1.NewValueData = "Character_Race"
DataRet1.AddDataValue (Charrace)
DataRet1.NewValueData = "Sex"
DataRet1.AddDataValue (Sex)
End Sub

This works, but instead of adding my values to the original Playername.ini
it ads it to a ini file thats called: .ini
No name to it. So how to i connect both playernames?

TextBox.text Content Retreival Of A Portion Of Text
Hi all,
I am stuck at a place where i have a text of 9 char length.
I need to retrieve the middle 3 characters....
eg:-
123456789
i can retrieve the first 3 characters(123) using the
Code:left("123456789",3)command
and retrieve the last 3 using the
Code:right("123456789",3)command

but how do i get the middle 3 characters(i.e. 456) extracted??

here is what i tried.

Code:str1 = txtBackground.Text
'store contents into a variant variable
str1 = Replace(str1, Left(str1, 3), "")
'replace the first 3 chars with ""
str1 = Replace(str1, Right(str1, 3), "")
'replace the last 3 chars with ""
finalstr = str1
'the final string in above example(456)

but, result of above operation is ""

any help shall be appreciated...
Please help me fast.
Thanks in Advance.


P.S.: I DONT WANT TO USE THE MID FUNCTION
------------------------------------------------------------------------------------------------

www.Tech-Arena.com/forums
The Indian Perspective Of Technology.

Edited by - Crazycoder on 9/19/2004 3:14:39 AM

Search (parse) A String For Content. Starting Letter Etc.
I would like to pick strings depending on parts of their content. A light search engine, if you will..

For example: I would like to be able to select strings that starts with a particular hardwired letter, say("a") and discard the rest. How would I go about doing this in VB6?

Any help is appretiated.




Edited by - SuperSonicVB on 8/17/2004 9:31:40 AM

Read Line By Line Of Text File And Move Content To Excel Record By Record
Hi,
   i am trying to move the selective information in the text file to Excel sheet record by record using VB.Can u help me in this regard.

The contents in text file is like:

"http://www.commerx.com/contact.html","inforequest@commerx.com"
"http://www.commerx.com/contact.html","ClientSupport@commerx.com"
"http://www.commerx.com/services-intranets.html","intranets@commerx.com"
"http://www.davacosourcing.com/company/","bignews@davacosourcing.com"
"http://www.davacosourcing.com/company/","careers@davacosourcing.com"
.
.
.
.
.
.

The above information need to be moved in Excel sheet record by record as:                    
http://www.commerx.com/contact.html        inforequest@commerx.com    
http://www.commerx.com/contact.html        ClientSupport@commerx.com    
http://www.commerx.com/services-intranets.html    intranets@commerx.com    
http://www.davacosourcing.com/company/ bignews@davacosourcing.com
http://www.davacosourcing.com/company/ careers@davacosourcing.com
.
.
.
.
..

Please do help in this regard as there are more than 1000 information that has to moved in the above pattern.

Thanx
babu


 

Getting A String From A Text File
What would be the best way to open a text file, find a string, delete it, perform an action then add the string back to the text file? !!!

ie

open text file
find "wibble"
if it exists - delete it
close text file

perform some action

open text file
add "wibble"
close text file

Any ideas people?
Simon

Copyright © 2005-08 www.BigResource.com, All rights reserved