|
-
Jun 17th, 2010, 12:28 AM
#1
Thread Starter
New Member
how to start modify array value?
Hi guys, I want to modify that myArr() value?
here is myArr()
myArr(0,0) = "john"
myArr(1,0) = "Jan"
myArr(0,1) = "mary
myArr(1,1) = "Dec"
myArr(0,2) = "sam"
myArr(1,2) = "Feb"
I want to modify "mary" , "Dec" to -> "mary" , "OCT"
how to start ?
please!
-
Jun 17th, 2010, 01:06 AM
#2
Re: how to start modify array value?
Well, you use:
myArr(0,1) = "mary
myArr(1,1) = "Dec"
So...
myArr(0,1) = "mary
myArr(1,1) = "OCT"
Software I use and highly recommend: Opera, Miranda IM, Peerblock, Winamp, Unlocker Assistant, JoyToKey, Virtual CloneDrive, Secunia PSI, ExplorerXP, GOM Player, Real Alternative, Quicktime Alternative,Sumatra PDF, and non-freeware: Photoshop and VB6( ).
My codebank: AllRGB, Rounded Rectangle(math), Binary Server, Buddy Paint, LoadPictureGDI+, System GUID/Volume Serial, HexToAsc, List all processes and their paths, quasiString matching
Strings(search, extraction, retrieval etc): Retrieve BBCode Link from HTML, RemoveBetween ()'s, strFindBetween(str1,str2), Insert text in HTML, HTML - GetSpanByID
-
Jun 17th, 2010, 01:23 AM
#3
Thread Starter
New Member
Re: how to start modify array value?
thanks, but I need this styles
how to start ,
please!
Code:
Text1.Text = "mary"
Text2.Text = "afterchaged"
for i = lbound(myArr,2) to ubound(myArr,2)
if myArr(0,i) = text1.text then
....modify that item
end if
next i
Code:
myArr(0,0) = "john"
myArr(1,0) = "Jan"
myArr(0,1) = "mary
myArr(1,1) = "afterchanged"
myArr(0,2) = "sam"
myArr(1,2) = "Feb"
-
Jun 17th, 2010, 01:31 AM
#4
Re: how to start modify array value?
Oh! You want to search.
Replace: ....modify that item
With: myArr(1,i) = "OCT"
Bon Appétit!
Software I use and highly recommend: Opera, Miranda IM, Peerblock, Winamp, Unlocker Assistant, JoyToKey, Virtual CloneDrive, Secunia PSI, ExplorerXP, GOM Player, Real Alternative, Quicktime Alternative,Sumatra PDF, and non-freeware: Photoshop and VB6( ).
My codebank: AllRGB, Rounded Rectangle(math), Binary Server, Buddy Paint, LoadPictureGDI+, System GUID/Volume Serial, HexToAsc, List all processes and their paths, quasiString matching
Strings(search, extraction, retrieval etc): Retrieve BBCode Link from HTML, RemoveBetween ()'s, strFindBetween(str1,str2), Insert text in HTML, HTML - GetSpanByID
-
Jun 17th, 2010, 01:48 AM
#5
Thread Starter
New Member
Re: how to start modify array value?
thanks, here i rewrite it, but faild ?
'Form 1
Code:
Option Explicit
Private Sub Command1_Click()
Call replacevalue(Text1.Text, Text2.Text)
End Sub
Private Sub Command2_Click()
Dim i As Integer
For i = LBound(myArr) To UBound(myArr)
List2.AddItem myArr(0, i) & ">" & myArr(1, i)
Next i
End Sub
Private Sub Form_Load()
Dim myArr() As String
ReDim myArr(0 To 1, 0 To 2)
myArr(0, 0) = "john"
myArr(1, 0) = "Jan"
myArr(0, 1) = "mary"
myArr(1, 1) = "Dec"
myArr(0, 2) = "sam"
myArr(1, 2) = "Feb"
End Sub
'Module 1
Code:
Option Explicit
Public myArr() As String
Public Function replacevalue(ByVal a As String, ByVal b As String)
Dim xi As Integer
For xi = LBound(myArr, 2) To UBound(myArr, 2)
If myArr(0, xi) = a Then
myArr(0, xi) = "was-changed" & myArr(0, xi)
myArr(1, xi) = "was-changed" & b
End If
Next xi
End Function
-
Jun 17th, 2010, 02:07 AM
#6
Re: how to start modify array value?
You declare myArr() in Form_Load where it is non-persistent and limited in scope to that procedure(Form_Load).
Local scope takes priority over your public declaration in the module. You could fully-qualify it: Module1.myArr(). BUT...
My suggestion is to remove that Dim myArr() in Form_Load. Leave the ReDim statement.
Software I use and highly recommend: Opera, Miranda IM, Peerblock, Winamp, Unlocker Assistant, JoyToKey, Virtual CloneDrive, Secunia PSI, ExplorerXP, GOM Player, Real Alternative, Quicktime Alternative,Sumatra PDF, and non-freeware: Photoshop and VB6( ).
My codebank: AllRGB, Rounded Rectangle(math), Binary Server, Buddy Paint, LoadPictureGDI+, System GUID/Volume Serial, HexToAsc, List all processes and their paths, quasiString matching
Strings(search, extraction, retrieval etc): Retrieve BBCode Link from HTML, RemoveBetween ()'s, strFindBetween(str1,str2), Insert text in HTML, HTML - GetSpanByID
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|