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




Save Text In Textbox To Array


Hi all

I was wondering how exactly do i save text , that is entered into a textbox to an Array by clicking a command button? I have tried using really basic coding
What i want it to do here is basically save text that is entered into the texbox for
Student(0)
Student(1)
and Student(2)
The problem im getting is that whatever is entered into the textbox saves in every array position! not individually ...

Dim Student(2) As String


Private Sub cmdStore_Click()
For i = 0 To 2
    Student(i) = txtEnter.Text
    txtDisplay.Text = Student(2) ` i used this as a checker basically , to see whether it                     displayed correctly
Next i

End Sub

As soon as i enter text in the textbox the Displayer displays what i entered.. but it shoudlnt because i said it to display Student(2) , which is what will be entered lastly ... but yea , its in a loop so im not really sure how to end it as well....
its a really simple problem , but ive probably made it stupidly complicated ....

Thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How Do I Save Multiline Textbox Text
am Using SQL for saving into MSAccess database
but its not Saving Multiline Text Box

VB Code:
SQL = " insert into Inward_local (Receipt_no,Receipt_date, Po_no,Dc_no,Dc_date,Invoice_no,User_dept," SQL = SQL & " Vendor_name,Vendor_add,Ship_date,Ship_time,Ship_day," SQL = SQL & " Carrier_name,LR_no,Vehicle_no,Tot_lbrs_chk,Tot_lbrs," SQL = SQL & " Cmn_lbrs_chk,Cmn_lbrs,MRN_no,Tot_pkgs,Qty_asper_challan,Acc_qty," SQL = SQL & " Wt_material,Tot_amount,Qty_damage_chk,Qty_damage,Qty_excess_chk,Qty_excess," SQL = SQL & " Qty_shortage_chk,Qty_shortage,Qty_wet_chk,Qty_wet,Remark,LF_no,Attain_by,Verify_by," SQL = SQL & " Certify_by,Security_by )" & " values (" & MDIchild3.txtreceiptno & ",'" & CDate(MDIchild3.txtreceiptdate) & "'," & MDIchild3.txtpono & "," SQL = SQL & MDIchild3.txtdcno & ",'" & CDate(MDIchild3.txtdcdate) & "'," & MDIchild3.txtinvoiceno & ", " SQL = SQL & "'" & MDIchild3.cbouserdept.Text & "','" & MDIchild3.cbovendorname.Text & "','" & [b]MDIchild3.txtvendoradd.Text [/b] & "', " SQL = SQL & "'" & CDate(MDIchild3.txtshipdate) & "','" & CDate(MDIchild3.txtshiptime) & "','" & MDIchild3.cboshipday.Text & "'," SQL = SQL & "'" & MDIchild3.cbocarrname.Text & "'," & MDIchild3.txtlrno & ",'" & MDIchild3.txtvehicleno.Text & "'," SQL = SQL & MDIchild3.chklbr.Value & "," & MDIchild3.txtnolbr & "," & MDIchild3.chkclbr.Value & "," & MDIchild3.txtcomlbr & "," SQL = SQL & MDIchild3.txtmrnl & "," & MDIchild3.txtnopkgs & "," & MDIchild3.txtqtychallan & "," & MDIchild3.txtaccqty & "," & MDIchild3.txtwtmaterial & "," SQL = SQL & MDIchild3.txttotamnt & "," & MDIchild3.chkdamage.Value & "," & MDIchild3.txtdamage & "," SQL = SQL & MDIchild3.chkexcess.Value & "," & MDIchild3.txtexcess & "," & MDIchild3.chkshortage.Value & "," SQL = SQL & MDIchild3.txtshortage & "," & MDIchild3.chkwet.Value & "," & MDIchild3.txtwet & "," SQL = SQL & "'" & MDIchild3.txtremark.Text & "','" & MDIchild3.txtlfno & "','" & MDIchild3.cboattainby.Text & "','" & MDIchild3.cboverifyby.Text & "'," SQL = SQL & "'" & MDIchild3.cbocertifyby.Text & "','" & MDIchild3.cbosecurityby.Text & "')"


i bolded out the Textbox
in that i have typed address
Ajmera hag complex
Pimpri, Pune 18

Problem :
First line saving into Database But Second Line not saving ie Pimpri Pune 18

I Need To Save A Textbox's Text To Binary File
im using some code i found to read in a binary file into a text box and display its hex value (0-9, A-F(G?))
now im allowing a user to change this text, but i have to find out how to save it back into a new binary file
ive searched and search but still cant do this right

previously i edited a section of one to replace the hex with a slider value which worked fine (i think) because i could use hex(slidervalue) but i cant use hex() with the letters can i?

im reall stuck on this, sorry if people have asked before, i couldnt find any posts that helped me

thanks

Save Array Into The Text File
Save array into the text file
Hi:

I open a text file that has data in it to store into an array:

"L666","Surge Protector","PC King","3.30","160","N"
"M013","MS Mouse","Memory Rex","23.22","28","N"
"H013","20 GB Hard Disk","Micro Shop","190.00","18","N"
"L005","17' Monitor","King","305.00","4","N"
"M713","56 K Baud Modem","Memory Rex","99.00","88","N

into an array:

ProductArray(iCounter, 0)
ProductArray(iCounter, 1)
ProductArray(iCounter, 2)
ProductArray(iCounter, 3)
ProductArray(iCounter, 4)
ProductArray(iCounter, 5)

but when I save it using Common Dialog Box to the text file, it looks like this in the text file:

L666 Surge Protector PC King 3.30 160 N
M013 MS Mouse Memory Rex 23.22 28 N
H013 20 GB Hard Disk Micro Shop 190.00 18 N
L005 17' Monitor King 305.00 4 N
M713 56 K Baud Modem Memory Rex 99.00 88 N


I don't know why:

here is my code for the Save:

Private Sub SaveProduct()
Dim iCounter As Integer
Dim FileNumber As Integer

' If there is nothing in the Inventory File then Exit the subroutine



If UBound(ProductArray) = 0 Then
Exit Sub
End If


FileNumber = FreeFile
CommonDialog1.Filter = "Text files (*.TXT)|*.TXT"
CommonDialog1.ShowSave
If CommonDialog1.FileName <> "" Then
Open CommonDialog1.FileName For Output As #FileNumber ' OPEN the path to the Addressbook database for Output to the file variable

' For each item in the Inventory File variable
' Write each item to the text file


For iCounter = 1 To UBound(ProductArray)

Write #FileNumber, ProductArray(iCounter, 0), ProductArray(iCounter, 1), ProductArray(iCounter, 2), ProductArray(iCounter, 3), ProductArray(iCounter, 4), ProductArray(iCounter, 5)

Next iCounter
LockupTextBoxes
cmdSubmit.Visible = False
cmdEdit.Caption = "Edit Record"
Picture1.Cls
cmdPrint.Visible = True
Close #FileNumber
End If
End Sub

Save Array Into The Text File
Hi:

I open a text file that has data in it to store into an array:

"L666","Surge Protector","PC King","3.30","160","N"
"M013","MS Mouse","Memory Rex","23.22","28","N"
"H013","20 GB Hard Disk","Micro Shop","190.00","18","N"
"L005","17' Monitor","King","305.00","4","N"
"M713","56 K Baud Modem","Memory Rex","99.00","88","N

into an array:

ProductArray(iCounter, 0)
ProductArray(iCounter, 1)
ProductArray(iCounter, 2)
ProductArray(iCounter, 3)
ProductArray(iCounter, 4)
ProductArray(iCounter, 5)

but when I save it using Common Dialog Box to the text file, it looks like this in the text file:

L666 Surge Protector PC King 3.30 160 N
M013 MS Mouse Memory Rex 23.22 28 N
H013 20 GB Hard Disk Micro Shop 190.00 18 N
L005 17' Monitor King 305.00 4 N
M713 56 K Baud Modem Memory Rex 99.00 88 N


I don't know why:

here is my code for the Save:

Private Sub SaveProduct()
Dim iCounter As Integer
Dim FileNumber As Integer

' If there is nothing in the Inventory File then Exit the subroutine



If UBound(ProductArray) = 0 Then
Exit Sub
End If


FileNumber = FreeFile
CommonDialog1.Filter = "Text files (*.TXT)|*.TXT"
CommonDialog1.ShowSave
If CommonDialog1.FileName <> "" Then
Open CommonDialog1.FileName For Output As #FileNumber ' OPEN the path to the Addressbook database for Output to the file variable

' For each item in the Inventory File variable
' Write each item to the text file


For iCounter = 1 To UBound(ProductArray)

Write #FileNumber, ProductArray(iCounter, 0), ProductArray(iCounter, 1), ProductArray(iCounter, 2), ProductArray(iCounter, 3), ProductArray(iCounter, 4), ProductArray(iCounter, 5)

Next iCounter
LockupTextBoxes
cmdSubmit.Visible = False
cmdEdit.Caption = "Edit Record"
Picture1.Cls
cmdPrint.Visible = True
Close #FileNumber
End If
End Sub

Save An Array To A Text File
Good Day!
I am currently developing a testing system that is designed to test the knowledge level in the university/school. This is a non-commercial product for my personal usage. It is composed of two main parts:
1. Test Writer - the module that can compose tests.
2. Test Executor - the module that performs the testing process.

At this moment I develop the Test Writer. Here is the main form:


Here is the full application code:
Option Explicit
Private lngIndex As Long
Private arData() As String

Private chkIndex As Long
Private chkData() As String
Function LoadQuestion()
Dim arTmp() As String
    Text8.Text = lngIndex
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Text5.Text = ""
    Text6.Text = ""
    Text7.Text = ""
    Text9.Text = ""
    arTmp = Split(arData(lngIndex), ";")
    If UBound(arTmp) = -1 Then Exit Function
arData(lngIndex) = ""
    Text1.Text = arTmp(0)
    Text2.Text = arTmp(1)
    Text3.Text = arTmp(2)
    Text4.Text = arTmp(3)
    Text5.Text = arTmp(4)
    Text6.Text = arTmp(5)
    Text7.Text = arTmp(6)
    Text9.Text = arTmp(7)
End Function

Private Sub Form_Load()
ReDim arData(1 To 9999)
    lngIndex = 1
    'Ïîêàçàòü òåêóùèé âîïðîñ
    LoadQuestion
    
ReDim chkData(1 To 9999)
    chkIndex = 1
    LoadCheck

End Sub


Private Sub cmdPrev_Click()
    If lngIndex = 1 Then Exit Sub
    arData(lngIndex) = Text1.Text & ";" & Text2.Text & ";" & Text3.Text & ";" & Text4.Text & ";" & Text5.Text & ";" & Text6.Text & ";" & Text7.Text & ";" & Text9.Text
    lngIndex = lngIndex - 1
    LoadQuestion
    
     If chkIndex = 1 Then Exit Sub
    chkData(chkIndex) = Check1.Value & ";" & Check2.Value & ";" & Check3.Value & ";" & Check4.Value & ";" & Check5.Value & ";" & Check6.Value
    chkIndex = chkIndex - 1
    LoadCheck
End Sub

Private Sub cmdNext_Click()
    If lngIndex = UBound(arData) Then Exit Sub
    arData(lngIndex) = Text1.Text & ";" & Text2.Text & ";" & Text3.Text & ";" & Text4.Text & ";" & Text5.Text & ";" & Text6.Text & ";" & Text7.Text & ";" & Text9.Text
    lngIndex = lngIndex + 1
    LoadQuestion
    
      If chkIndex = UBound(chkData) Then Exit Sub
    chkData(chkIndex) = Check1.Value & ";" & Check2.Value & ";" & Check3.Value & ";" & Check4.Value & ";" & Check5.Value & ";" & Check6.Value
    chkIndex = chkIndex + 1
    LoadCheck
End Sub


Private Sub LoadCheck()
Dim chkTmp() As String
    Check1.Value = False
    Check2.Value = False
    Check3.Value = False
    Check4.Value = False
    Check5.Value = False
    Check6.Value = False
    chkTmp = Split(chkData(chkIndex), ";")
    If UBound(chkTmp) = -1 Then Exit Sub
arData(lngIndex) = ""
    Check1.Value = chkTmp(0)
    Check2.Value = chkTmp(1)
    Check3.Value = chkTmp(2)
    Check4.Value = chkTmp(3)
    Check5.Value = chkTmp(4)
    Check6.Value = chkTmp(5)
End Sub

I would like to save the array indicated here in a file. Please, publish the code-solution for this problem (code-snippet) and a short explanation. If you know such kind of systems, please publish their names and links.
Thank You!

Save Word Document As Textbox Text And Date?
How can I save a word document as text from a textbox and todays date automatically and without getting messages then close MS Word.

Let's say textbox1.text has number 1 in it, when I click on a commandbutton1 it closes the document as 1_12-17-03.

I use VBA.

Thank you very much.

How To Save/read Textbox Text To/from Notepad File
Pls show me that how to save/read textbox text to/from notepad file. urgent please help me......

How To Copy Text From A Textbox && Save It To New .html File?
I would like to know how I could copy the text out of a text box and save it to a file.

If possible save it to a directory I can specify and the extension would be .htm.

Is this possible?

Thanks for any examples or code

Help!! I Need To Save The Contents Of My Array To A Text File!!! VB6
This is my statement:


If (MsgBox("Are you sure?", vbYesNo) = vbYes) Then


dlgSave.Filter = "Text Files(*.txt)|*.txt|All Files(*.*)|*.*"
dlgSave.DialogTitle = "Select Your File?"
dlgSave.FileName = ""

dlgSave.ShowSave
dlgSave.InitDir = App.Path

intFileNum = FreeFile
Open dlgSave.FileName For Output As #intFileNum
I = 1
For I = LBound(MyArray) To UBound(MyArray)
ReDim Preserve MyArray(I)
Print #intFileNum, MyArray(I).A, MyArray(I).B, MyArray(I).C, MyArray(I).D, MyArray(I).E, MyArray(I).F
Next I
Close #intFileNum
End If

i run the program and choose the output file that iwant. After i choose the file i go and open it to see the output and it is just a line of 0's. Why is this?
thanks

I Have An Array Of Bytes To Save To Disk As Text...
how can i parse at 10 chrs per line (CRLF...)?

Open MyFile For Binary as #1
Put #1,, MyArray 'can I add parameters there?
Close #1

...? thank you

Fastest Way To Save/retrieve Array Of Text From File
Ok, I have a huge list of files and some data about each and I need to save this to a text file then open it again and load it into an array again. I tried saving it as a | delimited text file, but when I try to read it back into an array, the Split() function is SO SLOW! I'm waiting up to 7 minutes to do this and I need to cut it down as much as possible. I either need the fastest way to split a text file by a character (load into a string? directly from file?) or a new way of storing this info. Thanx!

Textbox Text Into Array
dose and body here know how to get textfrom a text box and load it into an array

Save Array Data As A Text File Of 65 Characters Lines
Um Ubound(M) 'where M() is an array of bytes.
To save content of M as a text file where lines are 34 characters each(the last one will be 34 chrs or less), I can write the following code:

Open MyFile For Binary As #1
rew = StrConv(M, vbUnicode)
For i = 0 To (Um + 1) 34 - 1
Put #1, , Mid(rew, i * 34 + 1, 34) & _ vbCrLf
Next i
Put #1, , Right(rew, Len(rew) Mod 34)
Close #1

AY mentionned the CopyMemory function but I can't make it work if original data is contained in an array

thank you

Need Help To Retrieving Text From Array To The Textbox
Hi!
am now try to learning coding in vb to tetrive data from dynamic array after inputting data from different text boxes am getting difficulties to retrieve data from the arry to textboxes from where its inserted. but when am used these codes its returned me 0 and blank .here is the code pls let me know in urgent basis where problem lies.

   Option Explicit
Private d_name() As String
Private d_addr() As String
Private d_phno() As Double
Private i As Variant
Private i1 As Variant
Private i2 As Variant
'Private counter As Integer


Private Sub add_Click()
  Dim i As Integer
  Dim i1 As Integer
  Dim i2 As Integer
  Dim sname As String
  Dim saddr As String
  Dim lphno As Double
  sname = In_name.Text
  saddr = addrss.Text
  lphno = CDbl(phono.Text)
  For i = 0 To UBound(d_name)
         If sname = d_name(i) Then
              MsgBox "Sorry---Duplicate Name not allowed", vbOKOnly
         Else
          ReDim Preserve d_name(UBound(d_name) + 1)
          d_name(UBound(d_name)) = sname
        End If
   Next i
   For i1 = 0 To UBound(d_addr)
        ReDim Preserve d_addr(UBound(d_addr) + 1)
        d_addr(UBound(d_addr)) = saddr
        
    Next i1
    For i2 = 0 To UBound(d_phno)
        ReDim Preserve d_phno(UBound(d_phno) + 1)
        d_phno(UBound(d_phno)) = lphno
    Next i2
   In_name.Text = ""
   addrss.Text = ""
   phono.Text = ""
   In_name.SetFocus
End Sub

Private Sub Form_Load()
    ReDim d_name(i)
    ReDim d_addr(i1)
    ReDim d_phno(i2)
    Dim counter
    counter = d_name(i)
End Sub


Private Sub nxtshow_Click()
If d_name() < d_name(i) Then
In_name.Text = d_name()
addrss.Text = d_addr()
phono.Text = d_phno()

End Sub

pls let me know where i would mke changes and why????
thanks for help ......

How To Break Any Rich Textbox Text Into Multiple Array
I want to jump on the second form that has txtstreet, txtcity two text box
On form one I has a address text box I want when I press enter key on address text box on form 1 then this value go into form2 street textbox and next into state textbox
Split function not working see my coding




VB Code:
Private Sub CAddress_Click()Dim SNames() As StringDim N As IntegerIf Txtaddress(0).Visible = True ThenSNames = Split(Txtaddress(0).Text)    Else        If Txtaddress(1).Visible = True Then        SNames = Split(Txtaddress(1).Text)        Else        SNames = Split(Txtaddress(2).Text)        End IfEnd If Select Case UBound(SNames)    Case 0       'One name only (put it in surname?):        F_Address_Detail.TxtStreet.Text = SNames(0)    Case 1       'Two names (first/last?)       F_Address_Detail.TxtStreet.Text = SNames(0)       F_Address_Detail.TxtCity.Text = SNames(1)    Case Is > 1       'Three or more names (put all the last ones in the lastname textbox?)      F_Address_Detail.TxtStreet.Text = SNames(0)      F_Address_Detail.TxtCity.Text = SNames(1)       For N = 2 To UBound(SNames)           F_Address_Detail.TxtState.Text = F_Address_Detail.TxtState.Text & SNames(N) & IIf(N = UBound(SNames), vbNullString, "")           'F_Full_Name.Txtlast.Text = F_Full_Name.Txtlast.Text & SNames(N) & IIf(N = UBound(SNames), vbNullString, "")      Next NEnd Select F_Address_Add.Enabled = FalseF_Address_Detail.ShowEnd Sub

Save Single Column Array Into Variable Column Text?
So, I have an array with a couple thousand numbers that that represent values from a number of channels in one column. I'd like to put the numbers from one channel in one column. I have a listview that does that but now I'm trying to save the values into a text file. Right now to write them I have:

Open dlgSA.FileName For Output As #1 'dlgSA is the common dialog
On Error GoTo 0 ' turn off error handler

For K = 0 To arraySizeInSamps
Write #1, data(K)
Next K
Close #1 ' close the file
Exit Sub

The number of columns will be the same as the number of channels which is declared as: Dim numChannels As Long

Like I said before, my listView does have them separated in the correct columns but I can't figure out how to save that AS IS in a text or dat file.

Anybody have any ideas?

Thanks for your help.

How To Save Contents Of A Textbox Using Save Dialogbox
hi......... to all.

can some one tell me how to save the contents (text) of a text box as txt to the disk. By the help of a commondialog1 box.
every time contents are to be saved by a user defined file name.

do help me soon as the class submission is very close.

regards.

Passing Array Value In Textbox. The Textbox Turns Up Empty.
I am passing the value of an array to a textbox, but it always turns up empty. When i pass the same value to an excel cell, i get the value. The function calculates the value of USCityA

I am giving parts of the code below:
Redim Pline(9)
Pline(9) = USCityA
test = "Hello"
USA = test & Pline(9)

In another sub, i call this funtion above to allocate the value of USC to the city as shown below:

CityA = USA

Activesheet.OLEobjects("txtbCityA").Object.Value = "CityA:" & CityA


The value i get in my textbox is only "Hello". When i pass USA to an excel cell, i get "Hello Fortworth" (or whatever the value of "USA" is calculated in the function)

How To Setup An Array Using A Textbox Control Array?
I currently have an userform with 23 textboxes on it that the user
would input data to and save it as comma delimited text file. Then the
user would be able to bring back the text file and it would fill in
the appropriate textboxes which the data came from. So basically, you
could make updates to text file and retrieve the data from the text file as many times as you want. I pasted a snippet of my code below which does work, but I'm interested on how to rewrite the code more
efficiently using a textbox control array.


Dim SaveCurPrev as String
SaveCurPrev = "D:Text.txt"

'Saves data to text file
Open SaveCurPrevTxt For Output As #1
Write #1, txtBT4, txtLastISA, txtSecSysExt, txtSecInvWar, _
txtDayComms, txtSemiComs, txtLastsrdy, _
txtLastsrm1, txtLastsrm2, txtCompRun, txtTNC, txtInv, txtRisk, _
txtIBM, txtMVS, txtUNIX, txtVirus, txtDataBase, txtEOS, txtLANWAN, _ txtPrntBrst, txtComment, txtWeekend
Close #1



'Brings data back from textfile and fills in the textboxes
Dim OutPut1, OutPut2, OutPut3, OutPut4, OutPut5, OutPut6, OutPut7, _
OutPut8, OutPut9, OutPut10, OutPut11, OutPut12, OutPut13, _
OutPut14, OutPut15, OutPut16, OutPut17, OutPut18, _
OutPut19, OutPut20, OutPut21, OutPut22, OutPut23 As Variant

Open SaveCurPrevTxt For Input As #1
Do Until EOF(1)
Input #1, OutPut1, OutPut2, OutPut3, OutPut4, OutPut5, OutPut6, _
OutPut7, OutPut8, OutPut9, OutPut10, OutPut11, OutPut12, _
OutPut13, OutPut14, OutPut15, OutPut16, OutPut17, _
OutPut18, OutPut19, OutPut20, OutPut21, OutPut22, OutPut23

txtBT4 = OutPut1: txtLastISA = OutPut2: txtSecSysExt = OutPut3
txtSecInvWar = OutPut4: txtDayComms = OutPut5
txtSemiComs = OutPut6: txtLastsrdy = OutPut7
txtLastsrm1 = OutPut8: txtLastsrm2 = OutPut9: txtCompRun = OutPut10
txtTNC = OutPut11: txtInv = OutPut12: txtRisk = OutPut13
txtIBM = OutPut14: txtMVS = OutPut15: txtUNIX = OutPut16
txtVirus = OutPut17: txtDataBase = OutPut18: txtEOS = OutPut19
txtLANWAN = OutPut20: txtPrntBrst = OutPut21
txtComment = OutPut22: txtWeekend = OutPut23

Loop
Close #1

I hope someone can help on this.
Thanks,
Rich K.

ID An Individual Textbox In A Textbox Array
Hi to all!

Can anybody tell me what is the correct syntax to use when identifying an individual textbox in a textbox array.

The number of textBoxes differ all the time and does not have a fixed number of textboxes.

I need to print these textbox values but do not know how to identify them.

I have got this far: :-(

Dim i As Integer

For i = Text3.LBound To Text3.UBound

(I would like to ID the textboxes between these values)

GLEN

Save Text = Save Text && Text1
How would i make it so when i save the text in a textbox with

Open Text2.Text For Output As #1
Print #1, Text1
Close #1

that it will not rewrite the txt file but continue writing in it

Array Of Labels // Array Of Textbox
Hi everybody..
i'm kind of desperate...i spent hours on the internet and on this forum but i couldn't find an easy and clear example of how to create an array of labels and an array of a textbox..
is there anyone that can help me??
thx in advance!!!

Save In Textbox
My problem is that I would like to save what I write in a textbox in a txt-file. How can I do that best???

Please help...

Save To Textbox...
Dim hFile As Long
Dim sFilename As String
sFilename = App.Path & "/ipdc.txt"
hFile = FreeFile
Open sFilename For Output As #hFile
Print #hFile, ListView1.ListItems(ListView1.ListItems.Count)
Close #hFile

Now, the textfile which is saved is like this:

Code:
TEXT




but i want it like this:

Code:
TEXT


on the upper one theres a line 2... and now if I get the string of the textfile back to textbox:

Public Function FileText(filename$) As String
Dim handle As Integer
handle = FreeFile
Open filename$ For Input As #handle
FileText = Input$(LOF(handle), handle)
Close #handle
End Function

then if i compare it its not exactly the same string anymore, becuase somehow, even if multiline is Disabled it counts the 2nd Line of the textfile to it....

How can i make it delete the Enter which makes it go to the 2nd line? so its only 1 Line saved to textfile, without the Enter at the end of it...

Save Textbox Before 'new'
Hi folks,

I'm trying to make program save the contents of a textbox/rich text box if it has been changed. I've got to the bit of having a dialog box pop up, but that's as far as I've gone


VB Code:
Private Sub New_file()Dim Response As VbMsgBoxResult    If DocChanged = True Then        Response = MsgBox("The current file has been changed. Do you wish to save changes ?", vbYesNoCancel)        Select Case Response            Case vbCancel                Exit Sub            Case vbYes                MsgBox ("Works")        End Select    End If........


The MsgBox on 'Yes' is just for temp reasons.I have a comand button that saves the text box already, so if I can get the dialog box to run that sub, it should be set I think.

How To Save From A Textbox
Hi all
I wonder if one can tell me how can i save the content of a textbox, and which extension file should i use for it, and how do i open the file just saved

thanks all

Save As Textbox
When you use the common dialog control, and you bring up the save as, can you automatically place a value into that text box? I am using a calendar, and I want to place the date chosen directly into that save as dialog box.

Thanks

Save Changes In Textbox
Hi,

I'm tryng to create a Windows Form that pull data from 3 different tables and save it in another table. Right now I'm stroggling with pulling fields from one of my tables called DeliveryAdress and displaying those fields in my visual basic 2008 form. Well actually saving the changes into another table call Purchase Order.DeliveryAddress Table has Company Name,Adrress1,Adress2,City,State and ZipCode. And Purchase Order table has the same fields plus like 10 more fields, but what is happening right now is that i can display the fields on the form but it is only saving Company Name on Purchase Order Table.
I don't know if it because Company Name is a combobox and the other ones are textbox and they have different properties.
DeliveryAddress Table is a Validation table and once i click on Company Name on my form should display the rest of the fields and then save them on Purchase Order Table
Please someone could help me out.
I need to know is any other way to accomplish that?

Draw Textbox, Format Border And Type Text Into Textbox In A .doc File
I use this codes to open a .doc file and draw a textbox in it. What should I add to input text into the textbox (I used Selection.Text = "......." but the text are outside the textbox) and format it's borders?
[font=courier new][color=darkblue]
Private Sub Command1_Click()
Dim objWord As New Word.Application
Dim objDoc As Word.Document

objWord.DisplayAlerts = wdAlertsNone
Set objDoc = objWord.Documents.Add

objDoc.Shapes.AddTextbox msoTextOrientationHorizontal, 100, 100, 100, 300

objDoc.SaveAs "C:WINDOWSDesktoplabel.doc", wdFormatDocument
objWord.Quit

cmdEnd.SetFocus

Save TextBox To Word
Hi

I have a textbox and commandbutton

I want to save the text entered in the textbox in word by clicking the command button

thank's

Save Data Textbox
Hello everybody!!!

I have some text box who are results of query.

I want to save my data in textbox when the day change.

I start with weekday (datejour) = 2 = Monday

If today is monday, dataappears in textbox 53,59,65,71,77

Next day, data monday disappears, and data tuesday appears...
I want to save each data days..


Code:
Dim datejour As String

datejour = Format(Year(Date), "0000") & "-" & Format(Month(Date), "00") & "-" & Format(Day(Date), "00")

If WeekDay(datejour) = 2 Then

TextBox53.Value = Sheets("test").Range("bl3").Value
TextBox59.Value = Sheets("test").Range("bo3").Value
TextBox65.Value = Sheets("test").Range("bp3").Value
TextBox71.Value = Sheets("test").Range("w3").Value
TextBox77.Value = Val(TextBox88.Value) + Val(TextBox87.Value)

End If
If WeekDay(datejour) = 3 Then

TextBox54.Value = Sheets("test").Range("bl3").Value
TextBox60.Value = Sheets("test").Range("bo3").Value
TextBox66.Value = Sheets("test").Range("bp3").Value
TextBox72.Value = Sheets("test").Range("w3").Value
TextBox78.Value = Val(TextBox88.Value) + Val(TextBox87.Value)

End If
If WeekDay(datejour) = 4 Then

TextBox55.Value = Sheets("test").Range("bl3").Value
TextBox61.Value = Sheets("test").Range("bo3").Value
TextBox67.Value = Sheets("test").Range("bp3").Value
TextBox73.Value = Sheets("test").Range("w3").Value
TextBox79.Value = Val(TextBox88.Value) + Val(TextBox87.Value)

End If
If WeekDay(datejour) = 5 Then

TextBox56.Value = Sheets("test").Range("bl3").Value
TextBox62.Value = Sheets("test").Range("bo3").Value
TextBox68.Value = Sheets("test").Range("bp3").Value
TextBox74.Value = Sheets("test").Range("w3").Value
TextBox80.Value = Val(TextBox88.Value) + Val(TextBox87.Value)

End If
If WeekDay(datejour) = 6 Then

TextBox57.Value = Sheets("test").Range("bl3").Value
TextBox63.Value = Sheets("test").Range("bo3").Value
TextBox69.Value = Sheets("test").Range("bp3").Value
TextBox75.Value = Sheets("test").Range("w3").Value
TextBox81.Value = Val(TextBox88.Value) + Val(TextBox87.Value)

End If
Bye,

Tahbre

Save Textbox Value For Next Time
Excel 2003 w/VBA 6.3

Have a form with several textboxes in which a user will insert values.
The names of all the textboxes start with "txt", e.g. txtLotNum.
During the course of running the program I purposely "clear" (see below) the values from all textboxes. However, I would like to retain the value of one of the textboxes, so that when the user starts the program again after closing, that value already appears in the textbox on the form. Cuts down on data entry.


Code:
For Each Ctls In frmEasyLyteQC.Controls
If Left(Ctls.Name, 3) = "txt" Then
Ctls.Value = ""
End If
Next Ctls

Textbox Height Save
I am trying to save the settings of text boxes on a database(access) and keep getting an error message: Type Mismatch

Everything is working apart from saving the height adjustment.

I have on the form:

txtfields(0)
txtfields(1)
txtfields(2)
commondialog1

form code example
txtFields(0).Font.Bold = GetSetting(App.EXEName, "Defaults", "font Bold")
txtFields(0).Font.Name = GetSetting(App.EXEName, "Defaults", "Font Name")
txtFields(0).Font.Size = GetSetting(App.EXEName, "Defaults", "Font Size")
txtFields(0).Height = GetSetting(App.EXEName, "Defaults", "height")

txtFields(1).Font.Bold = GetSetting(App.EXEName, "Defaults", "Font Bold")
txtFields(1).Font.Name = GetSetting(App.EXEName, "Defaults", "Font Name")
txtFields(1).Font.Size = GetSetting(App.EXEName, "Defaults", "Font Size")

command button example
'On Error GoTo ErrorHandler

'With CommonDialog1
CommonDialog1.Flags = cdlCFScreenFonts
CommonDialog1.CancelError = True
CommonDialog1.ShowFont
'With txtFields(0)
txtFields(0).FontName = CommonDialog1.FontName
txtFields(0).FontSize = CommonDialog1.FontSize
'.Font.Strikethrough = CommonDialog1.FontStrikethru
'.Font.Underline = CommonDialog1.FontUnderline

txtFields(0).Height = TextHeight(txtFields(0).Text)

txtFields(0).Font.Name = CommonDialog1.FontName
txtFields(0).Font.Size = CommonDialog1.FontSize
txtFields(0).Font.Bold = CommonDialog1.FontBold
'.Height = TextHeight(txtFields(0).Text)
txtFields(1).Font.Name = CommonDialog1.FontName
txtFields(1).Font.Size = CommonDialog1.FontSize
txtFields(1).Font.Bold = CommonDialog1.FontBold

I aslo have two combo boxes that seem to adjust themselves.

Hope that has covered the problem
Thanks

Save Textbox Data
Hello everybody!!!

I have some text box who are results of query.

I want to save my data in textbox when the day change.

I start with weekday (datejour) = 2 = Monday

If today is monday, dataappears in textbox 53,59,65,71,77

Next day, data monday disappears, and data tuesday appears...
I want to save each data days.. :whoops:

Code:Dim datejour As String

datejour = Format(Year(Date), "0000") & "-" & Format(Month(Date), "00") & "-" & Format(Day(Date), "00")

If WeekDay(datejour) = 2 Then

TextBox53.Value = Sheets("test").Range("bl3").Value
TextBox59.Value = Sheets("test").Range("bo3").Value
TextBox65.Value = Sheets("test").Range("bp3").Value
TextBox71.Value = Sheets("test").Range("w3").Value
TextBox77.Value = Val(TextBox88.Value) + Val(TextBox87.Value)

End If
If WeekDay(datejour) = 3 Then

TextBox54.Value = Sheets("test").Range("bl3").Value
TextBox60.Value = Sheets("test").Range("bo3").Value
TextBox66.Value = Sheets("test").Range("bp3").Value
TextBox72.Value = Sheets("test").Range("w3").Value
TextBox78.Value = Val(TextBox88.Value) + Val(TextBox87.Value)

End If
If WeekDay(datejour) = 4 Then

TextBox55.Value = Sheets("test").Range("bl3").Value
TextBox61.Value = Sheets("test").Range("bo3").Value
TextBox67.Value = Sheets("test").Range("bp3").Value
TextBox73.Value = Sheets("test").Range("w3").Value
TextBox79.Value = Val(TextBox88.Value) + Val(TextBox87.Value)

End If
If WeekDay(datejour) = 5 Then

TextBox56.Value = Sheets("test").Range("bl3").Value
TextBox62.Value = Sheets("test").Range("bo3").Value
TextBox68.Value = Sheets("test").Range("bp3").Value
TextBox74.Value = Sheets("test").Range("w3").Value
TextBox80.Value = Val(TextBox88.Value) + Val(TextBox87.Value)

End If
If WeekDay(datejour) = 6 Then

TextBox57.Value = Sheets("test").Range("bl3").Value
TextBox63.Value = Sheets("test").Range("bo3").Value
TextBox69.Value = Sheets("test").Range("bp3").Value
TextBox75.Value = Sheets("test").Range("w3").Value
TextBox81.Value = Val(TextBox88.Value) + Val(TextBox87.Value)

End If

Bye,

Tahbre

Text Dissapears Form Textbox When I Tab Or Click Into Another Textbox
The title says it all really.

I enter text into txtName and then I want to enter text into txtInitial so I either tab to it or click into it and when I do the entry in txtName just dissapears.!!!???!!

I am setting textbox proerties at runtime...

Code:
With txtAddMemName
.Text = ""
.TabIndex = 0
End With
Make sure the textbox is empty....Text = ""
Set the TabIndex....TabIndex = 0 ....and so on
I have all the textbox properties in Private Sub TextBoxProperties() so that the form load section is easier to read.

Is that not right?

Textbox Ctl Right Justify Sends Text Too Far Out The The Textbox [SOLVED]
I have a newly made textbox control by Thief_ that I've modified and it works fine if Alignment is set to 0 - Left, but if set to 1 - Right Justify I have to type in several numbers before they start to appear from the right. How can I fix this? What property do I have to change / include in the control to control where the string begins when set to right justify?


Thanks

_________________________________________________________________

Edited by - vbprog1144 on 5/30/2005 5:33:50 PM

Save Array
hi


how to save strings which i recive to array

how to write this array to file

How Do I Save This Array????
How do i save this array after i have loaded it into a sorted listbox?


Code:
On Error GoTo err_handler

'Open the text file and slit up each lin into a string array
Open App.Path & "Callsigns.txt" For Input As #1
strArrBuff = Split(Input(LOF(1), 1), vbCrLf)
Close #1

'Iterate past each array element, and strip out the first part of the string
For intIdx = 0 To UBound(strArrBuff)
List2.AddItem Split(strArrBuff(intIdx), ";")(0)
Next


Open App.Path & "Callsigns.txt" For Output As #2
For intX = 0 To UBound(strArrBuff)
Print #2, List2.List(intX) ' What shoud i do here instead???
Next
Close #2
List2.Clear



Kind regards

Frank

Save Array
How can i write the following data to an file. And when the form loads read it back in the arrays?
Just like an database file


VB Code:
Dim strData(3, 1) Private Sub Form_Load()strData(0, 0) = "User 0"strData(1, 0) = "User 1"strData(2, 0) = "User 2"strData(3, 0) = "User 3"strData(0, 1) = "Pass 0"strData(1, 1) = "Pass 1"strData(2, 1) = "Pass 2"strData(3, 1) = "Pass 3"For i = 0 To 3MsgBox "Username: " & strData(i, 0) & " Password: " & strData(i, 1)NextEnd Sub

How Do You Save An Array ?
I am currently trying to write a program which will interface with an oscilloscope and produce a number of test as a waveform output.

The data transfers into an array and i would like to save this array as a .txt file by using the save as command button. The test are seperate so i wish to run each test and have the option of saving each test ??

Does anyone have any ideas?

Thanks

Save/Load Multiline Textbox
Hello,

I was wondering how I can save/load the contents of a multiline textbox to a .txt file...

Regards
Voltemort

Save Textbox Contents In Cell
I want to create a userform that has text boxes that ask questions such as name, company name, product........etc. I want to be able to send these answers from the text box entry to various cells in various worksheets in the same file upon hitting a "enter" command button. I understand how to create a user form with the text boxes. My question is how do you write code to populate the cells upon selceting the enter button? Any help is GREATLY appreciated.



Quote:





Originally Posted by couch612


why dont you just save the values the user entered in the textboxes in the first place to a file, or a database table, for later retrieval?

How Can I Make Save For The Textbox That I Had Creat
I put this code to creat a textbox


code:--------------------------------------------------------------------------------
Code:
Dim tn, ln, cn As Double
Dim tc, lc, cc As Double
Dim txt As TextBox
Private Sub Command1_Click()
Set txt = Controls.Add("VB.TextBox", "txt" & tn)
Set txt.Container = Form1
txt.Move 500, 1400 + tc, 1200, 350
txt.Visible = True
txt.Text = "TextBox" & tn & ""
tc = tc + 1000
tn = tn + 1
End Sub
--------------------------------------------------------------------------------


how can I make save for the textbox that I had creat
and thankyou for help

Save As .doc And .txt - Textbox && Command Button . . .
hello there, this is my first post here so iŽll make it quick (sorry for my bad english please!)

All right, i have RichTextBox and Command Button & Common Dialog (Visual Basic 6), now i want when i type some text in RichTextBox and click on Command button that dialog appears and you can choose that you can save that written text in RichTextBox in .Doc and .Txt format, can someone please tell me what code should i put in Command Button to do this?




Many thanks in advance, regards, Hrvoje

Save Textbox (with List) Into MS Access DB
I've created a textbox,txtMemo with scrollbar and also a adodc, adoRecord.
I'm trying to save the content of the textbox mentioned into the MS Access DB field, Memo.

Could anybody help me to figure this out? I'll be very thankful.

Save Info From Textbox To File?
hey guys I have a textbox called text1.text. I was wondering if there was a way so the user could press a button and save the info in the textbox as a textfile that says log and the date it was made?


The log could then be saved to their desktop?
Thanks!

Save Textbox Data To More Row Recordset
hi,please help how to save 5 textbox data to 5 recordset row at Ms access database.below is the current code.how to code it better.Is this method correct ??Thanks!

for example:
now i have 5 textbox data text1,text2,text3,text4,text5.i want to save the 5 textbox data to access recordset as 5 row data.


Code:
Private Sub cmdSave_Click()
Dim conDataConnection As Connection
Dim strSQL As String
Dim abc As Integer
Dim list_item As ListItems
Dim rs As ADODB.Recordset
Dim timefrom As String
Dim partno As String

'validate inspection PartNo is not empty
If IsEmpty(combopartno.Text) Then
MsgBox ("Select A Inspection Part NO Please!")
Exit Sub
Else
partno = (combopartno.Text)
End If


'validate inspection time is not empty
If Not IsDate(Txttime.Text) Then
MsgBox ("Select A Inspection Time Please!")
Exit Sub
Else
timefrom = TimeValue(Txttime)
End If


Set conDataConnection = New Connection
conDataConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & _
"SPC.mdb;Persist Security Info=False"

Set list_item = Me.ListView1.ListItems
For abc = 1 To list_item.Count
If list_item(abc).Checked = True Then
Exit For
End If
Next


Set rs = OpenRecordset("SELECT * FROM SpcData", adOpenStatic, adLockOptimistic)
With rs
.AddNew
.Fields("PartNo") = combopartno.Text
.Fields("Dimension") = list_item(abc).SubItems(1)
.Fields("Inspector") = Txtinspector.Text
.Fields("Date") = DTPicker1.Value
.Fields("Time") = Txttime.Text & ""
.Fields("Data") = Txtdata1.Text
.Update
Call sample2
MsgBox "Successed Save Inspection Data"
End With
ListView1.ListItems.clear
End Sub

Private Sub sample2()
Dim conDataConnection As Connection
Dim strSQL As String
Dim abc As Integer
Dim list_item As ListItems
Dim rs As ADODB.Recordset


Set conDataConnection = New Connection
conDataConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & _
"SPC.mdb;Persist Security Info=False"

Set list_item = Me.ListView1.ListItems
For abc = 1 To list_item.Count
If list_item(abc).Checked = True Then
Exit For
End If
Next

Set rs = OpenRecordset("SELECT * FROM SpcData", adOpenStatic, adLockOptimistic)
With rs
.AddNew
.Fields("PartNo") = combopartno.Text
.Fields("Dimension") = list_item(abc).SubItems(1)
' .Fields("MachineNo") = Txtmachineno.Text
.Fields("Inspector") = Txtinspector.Text
.Fields("Date") = DTPicker1.Value
.Fields("Time") = Txttime.Text & ""
.Fields("Data") = Txtdata2.Text

.Update
End With
End Sub


please help!.thanks

Save Code For Rich Textbox
I have a save as code in my menu under "File"
but I also want a save code. I want it so if its already saved it overights it but if its not you get to save it.

Here is my save as code:


Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If MsgBox("Are you sure you want to exit?", vbQuestion Or vbYesNo Or vbDefaultButton2, "Confirm exit") = vbYes Then
Unload Me
Else
Cancel = 1
End If
End Sub

Format Number TextBox Save To DB ???
I want to ask how to save Formated Textbox to DB without format.
Ex:

text1.text = 1,000,000

i want to save

text1.text = 1000000

thnx

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