To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
MSDN Subscribers: Download the VS 2010 Release Candidate
MSDN Subscribers: Download the VS 2010 Release Candidate
Sell Your Code and Make Money?
Creating your own Tetris game using VB.NET
Article :: Improving Software Economics, Part 4 of 7: Top 10 Principles of Iterative Software Management



Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier

Reply Post New Thread
 
Thread Tools Search this Thread Display Modes
Old May 28th, 2007, 11:54 AM   #1
janiceteh04
New Member
 
Join Date: May 07
Posts: 7
janiceteh04 is an unknown quantity at this point (<10)
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 12:02 PM.
janiceteh04 is offline   Reply With Quote
Old May 28th, 2007, 10:20 PM   #2
amrita
Fanatic Member
 
Join Date: Jan 07
Location: India
Posts: 540
amrita will become famous soon enough (50+)
Re: help please..

Remove vbCr from line
"inputLine (sMessage & vbCr)"

Onlu have inputLine (sMessage )
amrita is offline   Reply With Quote
Old May 29th, 2007, 02:24 AM   #3
Paul M
Interweb adm/o/distrator
 
Paul M's Avatar
 
Join Date: Nov 06
Location: Australia, Melbourne
Posts: 2,306
Paul M has a spectacular aura about (150+)Paul M has a spectacular aura about (150+)
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
__________________
If this post was helpful please rate it
If it wasn't for C, we would be using BASI, PASAL and OBOL.

VB6: [System Uptime] [Extracting WMP Song] [Basic Flood Protection] [RTF Editor]
[Hex/String Conversions] [Reading/Writing INI] [List Files in Directories]


C++: [Mute Audio in Vista]

VB.NET: [Associating a Help File] C#: [One instance of your application]
Paul M is offline   Reply With Quote
Old May 30th, 2007, 07:21 AM   #4
janiceteh04
New Member
 
Join Date: May 07
Posts: 7
janiceteh04 is an unknown quantity at this point (<10)
Re: help please..

oh..thanks..it help a lots..
but i change it in2 as below:

inputLine (Replace(sMessage, vbLf, "") & vbLf)

and it works!
janiceteh04 is offline   Reply With Quote
Old May 30th, 2007, 07:30 AM   #5
janiceteh04
New Member
 
Join Date: May 07
Posts: 7
janiceteh04 is an unknown quantity at this point (<10)
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..
janiceteh04 is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:19 PM.




To view more projects, click here

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.