Visual Basic Foro

Programación => Visual Basic 6 => Mensaje iniciado por: gibra en Marzo 03, 2013, 07:39:38 am

Título: Email control new methods?
Publicado por: gibra en Marzo 03, 2013, 07:39:38 am
Good work, Great!

But it seems to me that lack a couple of features:
1) a method to add several addresses in the block.
For example, when save and then read from a table (database) would be useful a method that adds to control the addresses read from the field of the table.
I created the public method SetEmailList into ucEmailControl:

Código: [Seleccionar]
Public Function SetEmailList (ByVal sListEmail As String) As String
     Dim i As Long
     Dim Sar () As String
     SAR = Split (sListEmail, ",")
     For i = 0 To UBound (SAR)
         If SAR (i) <> vbNullString Then
             AddInBox SAR (s)
             AddControl
             ReorderControls
             RaiseEvent Resize
         End If
     Next i
End Function

2) a method to reset all addresses.
I tried to use BoxClear() but I'm not
In fact the method ucContact1_DeleteAdress exist, but it is private, I know I have add a new event ItemRemovedAll and Public method DeleteAllAddress ():

Código: [Seleccionar]
Public Event ItemRemovedAll ()

Public Sub DeleteAllAddress ()
     Dim i As Long
     If col.Count> 0 Then
         For i = 1 To col.Count
             col.Remove "K" & i
             ReorderControls
         Next i
     End If
     RaiseEvent ItemRemovedAll
End Sub


Everything seems to work fine, but I found it difficult when I set address while the control is hidden.
Let me explain, in a form I have a TabControl and EmailControl is in a non-selected tab (hidden).
When I load the data from the database table does the TextBox1 isn't resized, remaining in the top left, above the first e-mail address, which remains partly hidden by the white rectangle of the TextBox1.
I tried to use different methods (i.e. ReorderControls, ...) but without success.
At  moment I solved hiding and showing the control:

Código: [Seleccionar]
ucEmailControl1.Visible = False
ucEmailControl1.Visible = True

I thought about using an API function (InvalideRectangle, ...) but I wanted to know your opinion.

Thank again.
Título: Re:Email control new methods?
Publicado por: gibra en Marzo 03, 2013, 02:20:19 pm
I correct the DeleteAllAddress method, the new code is:

Código: [Seleccionar]
Public Sub DeleteAllAddress()
    Dim i As Long
    If col.Count > 0 Then
        For i = col.Count To 1 Step -1
            ucContact1_DeleteAdress col(col.Count).Index
            ReorderControls
        Next i
    End If
    RaiseEvent ItemRemovedAll
End Sub

 :)