|
-
May 28th, 2007, 10:54 AM
#1
Thread Starter
New Member
help please..
hi,
the following is my coding to capture value and then display out the value.
Code:
Private Sub Form_Load()
Dim i As Integer
Dim id, nilai As String
Dim xL As cLine
clearScreen
i = 1
Me.Icon = frmMDI.ActiveForm.Icon
''clearScreen
''new function to display ERD database tablename n field
' 1st check shape.collection value
'If frmMDI.ActiveForm.lblLineCap(i).Caption = "M" Then
For i = 1 To frmMDI.ActiveForm.theBlockCollection.Count
With frmMDI.ActiveForm.theBlockCollection(frmMDI.ActiveForm.shp(i).Tag)
Dim st, st1, st2, dist As Integer
Dim a, b, pos, na, na1 As String
If .zAction <> "LINK" And .zAction <> "STAR" Then
id = .TagID
For Each xL In frmMDI.ActiveForm.theLineCollection
If id = xL.sFrom Then
nilai = xL.sCaption
End If
If nilai = "M" Then
na1 = na
na = .zParam1
If na <> na1 Then
'sMessage = "Nama Entiti: " & .zParam1 & vbLf
dist = Len(.zParam2)
st = 1
Do While dist > 1
st1 = InStr(st, .zParam2, vbCr & vbLf, vbTextCompare) + 1
'st2 = st - st1
st2 = st1 - st
'a = Mid(.zParam2, st, st2)
a = Mid(Replace(.zParam2, vbCr, ""), st, st2)
dist = dist - Len(a)
a = Left(a, Len(a) - 1)
pos = InStr(a, "@")
b = Mid(a, 1, pos - 1)
a = Mid(a, pos + 1)
st = st1
'MsgBox ("haha" & b & "haha")
If (a = "PK") Or (a = "FK") Then
If sM <> "" Then
sM = sM & "," & b
Else
sM = .zParam1 & "(" & b
End If
End If
If (a = "PK") Or (a = "") Then
If sM1 <> "" Then
sM1 = sM1 & "," & b
Else
sM1 = .zParam1 & "(" & b
End If
End If
Loop
sM = Trim(sM) & ")"
sM1 = Trim(sM1) & ")"
'MsgBox Trim(sM)
'MsgBox Trim(sM1)
sMessage = sMessage & sM
inputLine (sMessage & vbCr)
sMessage = sM1
inputLine (sMessage & vbCr)
sMessage = ""
sM = ""
sM1 = ""
End If
End If
Dim temp_id As String
Dim temp_penentu As String
Dim temp_bersandar As String
Dim na1x, nax As String
If nilai = "1" Then
na1x = nax
nax = .zParam1
If nax <> na1x Then
temp_id = .TagID
If temp_id = .IDRules Then
temp_penentu = .atribut_di
temp_bersandar = .atribut_ber
dist = Len(.zParam2)
st = 1
Do While dist > 1
st1 = InStr(st, .zParam2, vbCr & vbLf, vbTextCompare) + 1
st2 = st1 - st
a = Mid(.zParam2, st, st2)
'a = Mid(Replace(.zParam2, vbCr, ""), st, st2)
dist = dist - Len(a)
a = Left(a, Len(a) - 1)
pos = InStr(a, "@")
b = Mid(a, 1, pos - 1)
a = Mid(a, pos + 1)
st = st1
If (b = temp_penentu) Or (b = temp_bersandar) Then
If sM <> "" Then
sM = sM & "," & b
Else
sM = .zParam1 & "(" & b
End If
Else
If sM1 <> "" Then
sM1 = sM1 & "," & b
Else
sM1 = .zParam1 & "(" & b
End If
End If
Loop
sM = sM & ")"
sM1 = sM1 & ")"
sMessage = sMessage & sM
inputLine (sMessage & vbCr)
sMessage = sM1
inputLine (sMessage & vbCr)
sMessage = ""
sM = ""
sM1 = ""
End If
End If
End If
Next xL
End If
End With
Next i
End Sub
the output of this coding is as below:
entityName (attribute_a,
attribute_b,
attribut_c)
but, the actual output that i should have is as below:
entityName(attribute_a, attribute_b, attribut_c)
what should i do to solve this problem?
Last edited by janiceteh04; May 28th, 2007 at 11:02 AM.
-
May 28th, 2007, 09:20 PM
#2
Re: help please..
Remove vbCr from line
"inputLine (sMessage & vbCr)"
Onlu have inputLine (sMessage )
-
May 29th, 2007, 01:24 AM
#3
Re: help please..
Yep remove vbCr.
Also just on another note there is a couple of times that you should use vbNullString instead of "". It is less memory consuming
-
May 30th, 2007, 06:21 AM
#4
Thread Starter
New Member
Re: help please..
oh..thanks..it help a lots..
but i change it in2 as below:
inputLine (Replace(sMessage, vbLf, "") & vbLf)
and it works!
-
May 30th, 2007, 06:30 AM
#5
Thread Starter
New Member
Re: help please..
i have another problem here.actually im developing a Normalization Tool using Vb 6.0. the main function of this tool is user can draw ERD using drawing toolbar and then this tool will help to narmalized it.for sure,user must input attributes for each entity when drawing ERD.
the entity's name and attribute's name will be appear on the notation of Entity.is it possible if i wan to change the font size of attribute's name?and can give any ideas to do it?
thanks a lots..
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
|