Help Pls-how To Create User Defined Data Types

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rathika2786
    New Member
    • Feb 2008
    • 6

    Help Pls-how To Create User Defined Data Types

    Hi All,
    i m a new user to visual basic 6.can some one explain to me in detail as to how to create user defined data types?wat reference i should create for it?how to craete references?wher e should i add it in my project?
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Are you trying to refer any external DLL ?

    Comment

    • rathika2786
      New Member
      • Feb 2008
      • 6

      #3
      Originally posted by debasisdas
      Are you trying to refer any external DLL ?
      HI debasisdas,

      ya i want to refer to an external dll.
      actually tis proj was already created.wen i compiled it i got an error "user defined type not defined".i enclose the code here.

      Dim OBJ1 As Class1
      Dim OBJ2 As Class2
      Dim FRM As Form
      Public RAD As Long

      Private Sub cmdCheckCatarac t_Click()
      Set FRM = Me
      ' TO DISPLAY THE RESULT IN SEPERATE FORM
      'Set frm = New Form2
      ' FRM.Left = Me.Left + Me.Width
      ' FRM.Top = Me.Top
      With picTemp
      .Width = picImage.Width
      .Height = picImage.Height
      .PaintPicture picImage.Image, 0, 0
      End With
      OBJ2.getWhitePi xels FRM, picTemp, FRM.picImage, Me.Caption
      End Sub

      Private Sub cmdEdgeDetectio n_Click()
      Set FRM = Me
      ' TO DISPLAY THE RESULT IN SEPERATE FORM
      'Set FRM = New Form2
      ' FRM.Left = Me.Left + Me.Width
      ' FRM.Top = Me.Top
      With picTemp
      .Width = picImage.Width
      .Height = picImage.Height
      .PaintPicture picImage.Image, 0, 0
      End With
      OBJ2.edgeDetect ion FRM, picTemp, FRM.picImage, Me.Caption
      End Sub


      Private Sub cmdGrayScale_Cl ick()
      Set FRM = Me
      ' TO DISPLAY THE RESULT IN SEPERATE FORM
      ' Set FRM = New Form2
      ' FRM.Left = Me.Left + Me.Width
      ' FRM.Top = Me.Top
      With picTemp
      .Width = picImage.Width
      .Height = picImage.Height
      .PaintPicture picImage.Image, 0, 0
      End With
      OBJ2.grayScale FRM, picTemp, FRM.picImage, Me.Caption
      End Sub

      Private Sub cmdLoadPicture_ Click()
      OBJ2.FILE_NAME = Me.Caption
      OBJ2.loadImage Me, picImage
      End Sub

      here i m getting a error in the first two lines.i dont know where class1 and class2 are defined and how to reference to it.pls help

      Comment

      • mafaisal
        New Member
        • Sep 2007
        • 142

        #4
        Hello
        if Class1 & Class2 are External, I this that is register in ur system,
        Please go to project reference, search these dll there and select that
        then try
        Faisal

        Originally posted by rathika2786
        HI debasisdas,

        ya i want to refer to an external dll.
        actually tis proj was already created.wen i compiled it i got an error "user defined type not defined".i enclose the code here.

        Dim OBJ1 As Class1
        Dim OBJ2 As Class2
        Dim FRM As Form
        Public RAD As Long

        Private Sub cmdCheckCatarac t_Click()
        Set FRM = Me
        ' TO DISPLAY THE RESULT IN SEPERATE FORM
        'Set frm = New Form2
        ' FRM.Left = Me.Left + Me.Width
        ' FRM.Top = Me.Top
        With picTemp
        .Width = picImage.Width
        .Height = picImage.Height
        .PaintPicture picImage.Image, 0, 0
        End With
        OBJ2.getWhitePi xels FRM, picTemp, FRM.picImage, Me.Caption
        End Sub

        Private Sub cmdEdgeDetectio n_Click()
        Set FRM = Me
        ' TO DISPLAY THE RESULT IN SEPERATE FORM
        'Set FRM = New Form2
        ' FRM.Left = Me.Left + Me.Width
        ' FRM.Top = Me.Top
        With picTemp
        .Width = picImage.Width
        .Height = picImage.Height
        .PaintPicture picImage.Image, 0, 0
        End With
        OBJ2.edgeDetect ion FRM, picTemp, FRM.picImage, Me.Caption
        End Sub


        Private Sub cmdGrayScale_Cl ick()
        Set FRM = Me
        ' TO DISPLAY THE RESULT IN SEPERATE FORM
        ' Set FRM = New Form2
        ' FRM.Left = Me.Left + Me.Width
        ' FRM.Top = Me.Top
        With picTemp
        .Width = picImage.Width
        .Height = picImage.Height
        .PaintPicture picImage.Image, 0, 0
        End With
        OBJ2.grayScale FRM, picTemp, FRM.picImage, Me.Caption
        End Sub

        Private Sub cmdLoadPicture_ Click()
        OBJ2.FILE_NAME = Me.Caption
        OBJ2.loadImage Me, picImage
        End Sub

        here i m getting a error in the first two lines.i dont know where class1 and class2 are defined and how to reference to it.pls help

        Comment

        • rathika2786
          New Member
          • Feb 2008
          • 6

          #5
          Originally posted by mafaisal
          Hello
          if Class1 & Class2 are External, I this that is register in ur system,
          Please go to project reference, search these dll there and select that
          then try
          Faisal
          hi Faisal,
          wen i compile tis code i m gettting the error user defined type not defined.

          Option Explicit
          Dim fso As New FileSystemObjec t
          Dim TS As TextStream
          Dim TS1 As TextStream
          Dim TEMP1$, TEMP2$
          Private mvarFILE_NAME As String 'local copy
          Dim X&, Y&
          Dim R&, G&, B&
          Dim IMAGE_HEIGHT&

          Public Sub loadImage(FRM As Form, PB As PictureBox) 'To load the picture
          On Error GoTo ERR
          PB.Picture = LoadPicture(mva rFILE_NAME)
          FRM.Width = PB.Width + 100
          FRM.Height = PB.Height + 400
          FRM.Visible = True
          noOfForms = noOfForms + 1
          With MDIForm1.tbrFil e
          .Buttons(2).Ena bled = True
          .Buttons(4).Ena bled = True
          .Buttons(6).Ena bled = True
          End With
          With MDIForm1.tbrEdi t
          .Buttons(4).Ena bled = True
          End With
          Exit Sub
          ERR:
          Unload FRM
          MsgBox ERR.Description , vbCritical, "Unable to load the image"
          Set TS = fso.OpenTextFil e(App.Path & "\FILES_OPENED. TXT", ForReading, True)
          Set TS1 = fso.OpenTextFil e(App.Path & "\TEMP.TXT" , ForWriting, True)
          X = 1
          While Not TS.AtEndOfLine
          TEMP1 = TS.ReadLine
          TEMP2 = Mid(TEMP1, InStr(1, TEMP1, ".") + 1, Len(TEMP1))
          'TEMP2 = Mid(TEMP1, 4, Len(TEMP1))
          If mvarFILE_NAME = TEMP2 Then
          'MsgBox "DELETED"
          Else
          TEMP2 = "&" & X & "." & TEMP2
          TS1.WriteLine (TEMP2)
          MDIForm1.mnuFil eFileopened(X). Caption = TEMP2
          X = X + 1
          End If
          Wend
          MDIForm1.mnuFil eFileopened(X). Visible = False
          Unload MDIForm1.mnuFil eFileopened(X)
          If X = 1 Then
          MDIForm1.mnuFil eBar5.Visible = False
          Else
          MDIForm1.mnuFil eBar5.Visible = True
          End If
          FO_INDEX = X
          TS.Close
          TS1.Close
          fso.DeleteFile App.Path & "\FILES_OPENED. TXT"
          fso.MoveFile App.Path & "\TEMP.TXT" , App.Path & "\FILES_OPENED. TXT"
          End Sub

          Public Property Let FILE_NAME(ByVal vData As String)
          mvarFILE_NAME = vData
          End Property

          in 2nd ,3rd, line.wat apppropriate dll shld i add in the reference.how will i find wat is appropriate reference.

          Comment

          Working...