PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
need help (Hope Probably some thing simple)-VBForums
Results 1 to 5 of 5

Thread: need help (Hope Probably some thing simple)

  1. #1

    Thread Starter
    Lively Member hidroela's Avatar
    Join Date
    Mar 2004
    Posts
    107

    Thumbs up need help (Hope Probably some thing simple)

    Ok I have a main app that use a VB 6.0 activex dll to upgrade a flex grid with some data. My problem is that when I move the form around the screen the flex grid stop upgrading and kind to freeze until I release the form a quit moving it
    this is Basically the code
    VB Code:
    1. Option Explicit
    2. 'Reference to RS232.dll
    3. Public WithEvents DF1Driver As RS_232.Driver
    4. Private Sub DF1Driver_DataChange(ByVal addreess As String, _
    5.                                  ByVal Value As Variant, _
    6.                                  ByVal TransactionTime As Long, _
    7.                                  ByVal Quality As String)
    8.     On Error GoTo DF1Driver_DataChange_Err
    9.     Select Case addreess
    10.         Case "N7:0"
    11.             MSHFlexGrid.TextMatrix(1, 1) = addreess
    12.             MSHFlexGrid.TextMatrix(1, 2) = Value
    13.             MSHFlexGrid.TextMatrix(1, 3) = Quality
    14.     End Select
    15.     trasntxt.Text = TransactionTime
    16.     Exit Sub
    17. DF1Driver_DataChange_Err:
    18.     MsgBox Err.Description & vbCrLf & _
    19.             "in Project1.Form1.DF1Driver_DataChange " & "at line " & Erl
    20.     Resume Next
    21. End Sub
    22. Private Sub Form_Load()
    23.     On Error GoTo Form_Load_Err
    24.     Set DF1Driver = New RS_232.Driver
    25.     'set plc
    26.     With DF1Driver
    27.         .ProcessorType = [PLC 5]
    28.         .DHNodeAddress = 1
    29.         .RemoteNodeAddress = 0
    30.         .CalcCheckSum = CRC
    31.         'set scan time
    32.         .UpgradeRate = 250
    33.         'set comm port
    34.         .Comm_CommPort = 1
    35.         .Comm_Settings = "19200,N,8,1"
    36.         'Number of elements to scan
    37.         .NumberOfElements = 1
    38.         '35
    39.         .DataReadBiteSize = [A Word]
    40.         'data to scan
    41.         '''N7:5
    42.         .FileNumber(1) = 7
    43.         .ElementNumber(1) = 0
    44.         .SubElementNumber(1) = 0
    45.         .FileType(1) = Intege_r
    46.         ''''''''''''''''''''''''''''''''
    47.     End With
    48.     With MSHFlexGrid
    49.         .Cols = 4
    50.         .ColAlignment(2) = flexAlignCenterCenter
    51.         .FillStyle = flexFillRepeat
    52.         .TextMatrix(0, 0) = " "
    53.         .TextMatrix(0, 1) = "Address"
    54.         .TextMatrix(0, 2) = "Value"
    55.         .TextMatrix(0, 3) = "Quality"
    56.         .ColAlignmentFixed(-1) = flexAlignCenterCenter
    57.         .ColWidth(0) = 300
    58.         .ColWidth(1) = 800
    59.         .ColWidth(2) = 1000
    60.         .ColWidth(3) = 800
    61.         .MSHFlexGrid.Rows = 12
    62.         .Height = 12 * (.RowHeight(1) + 5)
    63.     End With
    64.     Exit Sub
    65. Form_Load_Err:
    66.     MsgBox Err.Description & vbCrLf & "in Project1.Form1.Form_Load " & _
    67.             "at line " & Erl
    68.     Resume Next
    69. End Sub
    70. Private Sub Form_Unload(Cancel As Integer)
    71.     On Error GoTo Form_Unload_Err
    72.     Set DF1Driver = Nothing
    73.     Set Form1 = Nothing
    74.     Exit Sub
    75. Form_Unload_Err:
    76.     MsgBox Err.Description & vbCrLf & "in Project1.Form1.Form_Unload " & _
    77.             "at line " & Erl
    78.     Resume Next
    79. End Sub

    Any help would be appreciated
    Hidroilio Pérez

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    103,236

    Re: need help (Hope Probably some thing simple)

    Wrong forum I think.

  3. #3

    Thread Starter
    Lively Member hidroela's Avatar
    Join Date
    Mar 2004
    Posts
    107

    Re: need help (Hope Probably some thing simple)

    I could be wrong but this is not the VB net forum section. the fact that you see MSHFlexGrid from VB 6.0 on it is because you can use it in net I just learned this today

    Any help would be appreciated
    Best Regards Hidroilio Pérez
    Last edited by hidroela; Aug 14th, 2005 at 08:54 PM.

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    103,236

    Re: need help (Hope Probably some thing simple)

    Sorry. Even at a second glance this still looks rather like VB6 code, though.

  5. #5

    Thread Starter
    Lively Member hidroela's Avatar
    Join Date
    Mar 2004
    Posts
    107

    Re: need help (Hope Probably some thing simple)

    Ok this looks more like VB NET
    VB Code:
    1. Public Class Form1
    2.     Public WithEvents DF1Driver As RS_232.Driver
    3.  
    4.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    5.         DF1Driver = New RS_232.Driver
    6.         'set plc
    7.         With DF1Driver
    8.             .ProcessorType = RS_232.ProcesorType.PLC_5
    9.             .DHNodeAddress = 1
    10.             .RemoteNodeAddress = 0
    11.             .CalcCheckSum = RS_232.CheckSumType.CRC
    12.             'set scan time
    13.             .UpgradeRate = 250
    14.             'set comm port
    15.             .Comm_CommPort = 1
    16.             .Comm_Settings = "19200,N,8,1"
    17.             'Number of elements to scan
    18.             .NumberOfElements = 2
    19.             'bits to read
    20.             .DataReadBiteSize = RS_232.DataReadTranBiteSize.A_Word
    21.             '''N7:5
    22.             .FileNumber(1) = 7
    23.             .ElementNumber(1) = 0
    24.             .SubElementNumber(1) = 0
    25.             .FileType(1) = RS_232.FileType.Intege_r
    26.             ''''''''''''''''''''''''''''''''
    27.             '''N7:5
    28.             .FileNumber(2) = 7
    29.             .ElementNumber(2) = 10
    30.             .SubElementNumber(2) = 0
    31.             .FileType(2) = RS_232.FileType.Intege_r
    32.             ''''''''''''''''''''''''''''''''
    33.         End With
    34.         'fillCombo()
    35.         MSHFlexGrid.Rows = 12
    36.         With MSHFlexGrid
    37.             .set_Cols(0, 4)
    38.             .set_ColAlignment(2, 1)
    39.             .FillStyle() = MSHierarchicalFlexGridLib.FillStyleSettings.flexFillRepeat
    40.             .set_TextMatrix(0, 0, " ")
    41.             .set_TextMatrix(0, 1, "Address")
    42.             .set_TextMatrix(0, 2, "Value ")
    43.             .set_TextMatrix(0, 3, "Quality")
    44.             .set_ColAlignmentFixed(2, -1)
    45.             .set_ColWidth(0, 300)
    46.             .set_ColWidth(1, 800)
    47.             .set_ColWidth(2, 1000)
    48.             .set_ColWidth(3, 800)
    49.             .Width = 300
    50.         End With
    51.  
    52.     End Sub
    53.  
    54.     Private Sub Command1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command1.Click
    55.         If DF1Driver.Start_Stop_Scan = False Then
    56.             Select Case DF1Driver.Comm_PortOpen
    57.                 Case False
    58.                     DF1Driver.Comm_PortOpen = True
    59.                 Case True
    60.                     DF1Driver.Comm_PortOpen = False
    61.             End Select
    62.         End If
    63.     End Sub
    64.  
    65.     Private Sub StartStopcmd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartStopcmd.Click
    66.         Select Case DF1Driver.Start_Stop_Scan
    67.             Case False
    68.                 StartStopcmd.Text = "Stop Scan"
    69.                 DF1Driver.Start_Stop_Scan = True
    70.             Case True
    71.                 StartStopcmd.Text = "Start Scan"
    72.                 DF1Driver.Start_Stop_Scan = False
    73.         End Select
    74.  
    75.     End Sub
    76.  
    77.     Private Sub DF1Driver_DataChange(ByVal Address As String, ByVal Value As String, ByVal TransactionTime As Integer, ByVal Quality As String) Handles DF1Driver.DataChange
    78.         With MSHFlexGrid
    79.             Select Case Address
    80.                 Case "N7:0"
    81.                     .set_TextMatrix(1, 1, Address)
    82.                     .set_TextMatrix(1, 2, Value)
    83.                     .set_TextMatrix(1, 3, Quality)
    84.                 Case "N7:10"
    85.                     .set_TextMatrix(2, 1, Address)
    86.                     .set_TextMatrix(2, 2, Value)
    87.                     .set_TextMatrix(2, 3, Quality)
    88.             End Select
    89.         End With
    90.     End Sub
    91. End Class

    Any help would be appreciated
    Best Regards Hidroilio Pérez

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width