Subversion Repositories projects.vncstarter

Rev

Blame | Last modification | View Log

VERSION 5.00
Begin VB.Form frmAddEdit 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Add/Edit a connection"
   ClientHeight    =   2715
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   5115
   Icon            =   "frmAddEdit.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   181
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   341
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox Text2 
      Appearance      =   0  'Flat
      Height          =   315
      Left            =   1200
      TabIndex        =   1
      Top             =   675
      Width           =   2040
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   315
      Left            =   1200
      TabIndex        =   0
      Top             =   315
      Width           =   3750
   End
   Begin VNCstarter.jjButton jjButton1 
      Default         =   -1  'True
      Height          =   405
      Left            =   2475
      TabIndex        =   2
      Top             =   2175
      Width           =   1230
      _ExtentX        =   2170
      _ExtentY        =   714
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "Save"
      jjButtonStyle   =   9
   End
   Begin VNCstarter.jjButton jjButton2 
      Height          =   405
      Left            =   3750
      TabIndex        =   3
      Top             =   2175
      Width           =   1230
      _ExtentX        =   2170
      _ExtentY        =   714
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "Cancel"
      jjButtonStyle   =   9
   End
   Begin VB.Label Label3 
      Caption         =   $"frmAddEdit.frx":014A
      Height          =   690
      Left            =   315
      TabIndex        =   6
      Top             =   1380
      Width           =   4185
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "IP-address:"
      Height          =   195
      Left            =   360
      TabIndex        =   5
      Top             =   720
      Width           =   795
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Comments:"
      Height          =   195
      Left            =   360
      TabIndex        =   4
      Top             =   360
      Width           =   780
   End
End
Attribute VB_Name = "frmAddEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit



Private Sub Form_Load()
    If gNyAdresse = False Then
        Text1.Text = frmMainWindow.ListView1.SelectedItem.Text
        Text2.Text = frmMainWindow.ListView1.SelectedItem.SubItems(1)
    End If
    
End Sub

Private Sub jjButton1_Click()
    On Error GoTo PROC_ERR
    If Text1.Text = "" Then MsgBox "You must enter a comment for this connection"
    If Text2.Text = "" Then MsgBox "You must enter an IP-address for this connection"
    Dim NyAdresse As String
    Dim NyKommentar As String
    Dim Dato As String
    Dim FilNr As Integer
    Dim f As Long
    Dim retval As Long
    'gNyAdresse = True
    
    NyAdresse = Trim(Text2.Text)
    If NyAdresse = "" Or NyAdresse = "http://" Then
        Unload Me
        GoTo PROC_EXIT
    End If
    
    NyKommentar = Text1
    If NyAdresse <> "" Or NyKommentar <> "" Then
        'Om ny adresse, vis denne i adresse listen
        If gNyAdresse = True Then
            With frmMainWindow.ListView1
                .Sorted = False
                .Visible = False
                .ListItems.Add , , NyKommentar
                .ListItems.Item(.ListItems.Count).SubItems(1) = NyAdresse
                .Sorted = True
                .Visible = True
            End With
            
        'Om bare endring av merket felt
        Else
            For f = frmMainWindow.ListView1.ListItems.Count To 1 Step -1
                If frmMainWindow.ListView1.ListItems(f).Selected = True Then
                    frmMainWindow.ListView1.ListItems.Item(f).Text = NyKommentar
                 frmMainWindow.ListView1.ListItems.Item(f).SubItems(1) = NyAdresse
                End If
            Next f
        End If
        
        
        'Lagre hele listen på ny
        Call LagreFavoritter
        
    End If
    
    Unload Me
    
PROC_EXIT:
    Exit Sub
    
PROC_ERR:
    'Call ShowError(Me.Name, "General_Ok", Err.Number, Err.Description)
    GoTo PROC_EXIT
End Sub

Private Sub jjButton2_Click()
    Unload Me
End Sub