Click here to Skip to main content
15,887,135 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Decimal To Octal,Vb.net Pin
Ron Beyer24-Sep-13 5:58
professionalRon Beyer24-Sep-13 5:58 
GeneralRe: Decimal To Octal,Vb.net Pin
srinivasankrishnaa24-Sep-13 6:08
srinivasankrishnaa24-Sep-13 6:08 
GeneralRe: Decimal To Octal,Vb.net Pin
Ron Beyer24-Sep-13 7:00
professionalRon Beyer24-Sep-13 7:00 
Question.net usercontrols and the vs2010 designer Pin
Member 774863018-Sep-13 12:17
Member 774863018-Sep-13 12:17 
AnswerRe: .net usercontrols and the vs2010 designer Pin
Dave Kreskowiak18-Sep-13 13:14
mveDave Kreskowiak18-Sep-13 13:14 
GeneralRe: .net usercontrols and the vs2010 designer Pin
Member 774863018-Sep-13 13:55
Member 774863018-Sep-13 13:55 
GeneralRe: .net usercontrols and the vs2010 designer Pin
Dave Kreskowiak18-Sep-13 15:07
mveDave Kreskowiak18-Sep-13 15:07 
Question[VB.NET 2008] A runtime created Timer doesn't work Pin
steve_949661318-Sep-13 1:43
professionalsteve_949661318-Sep-13 1:43 
Hi everybody,
my application runs on WinCE 5 device, it communicates with a PLC via modbus/TCP and it integrates a web server (code found in the article "Create your own Web Server using C#").
I'm trying to manage the remote access (from web browser) with user authentication and session timeout.
Every user is an object of the following class:

VB
Public Class CWebUser

  Private mUserName As String = ""         'nome utente
  Private mPassword As String = ""         'MD5 della password 
  Private mIP As String = ""               'IP di provenienza della connessione
  Private mStartSession As Long = 0        'istante di inizio della connessione come ticks
  Private mLogged As Boolean = False       'flag per sapere se l'utente è loggato
  Private WithEvents mWUTimer As System.Windows.Forms.Timer   'timer per gestire la durata della connessione

  Sub New()
    mWUTimer = New System.Windows.Forms.Timer()
    mWUTimer.Enabled = False
    mWUTimer.Interval = 10000
    AddHandler (mWUTimer.Tick), AddressOf WUTimer_Tick
  End Sub

  Private Sub WUTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
    If ((DateTime.Now.Ticks - mStartSession) > (CGlobali.WebSessionDuration * 10000000)) Then
      mWUTimer.Enabled = False
      mIP = ""
      mLogged = False
    End If
  End Sub

  Public Property UserName() As String
    Get
      Return mUserName
    End Get
    Set(ByVal value As String)
      mUserName = value
    End Set
  End Property

  Public Property Password() As String
    Get
      Return mPassword
    End Get
    Set(ByVal value As String)
      mPassword = value
    End Set
  End Property

  Public Property IP() As String
    Get
      Return mIP
    End Get
    Set(ByVal value As String)
      mIP = value
    End Set
  End Property

  Public Property StartSession() As Long
    Get
      Return mStartSession
    End Get
    Set(ByVal value As Long)
      mStartSession = value
    End Set
  End Property

  Public Property Logged() As Boolean
    Get
      Return mLogged
    End Get
    Set(ByVal value As Boolean)
      mLogged = value
    End Set
  End Property

  Public Property WUTimer() As System.Windows.Forms.Timer
    Get
      Return mWUTimer
    End Get
    Set(ByVal value As System.Windows.Forms.Timer)
      mWUTimer = value
    End Set
  End Property

End Class

When the application starts, it creates a list of authorized users.

When someone logs in, if UserName and Password are OK, I call the following sub:

VB
Private Sub SetWUser(ByVal Name As String, ByVal IP As String)
  Dim i As Int32

  For i = 0 To (CGlobali.Users.Count - 1)
    If (Name = CType(CGlobali.Users.Item(i), CWebUser).UserName) Then
      CType(CGlobali.Users.Item(i), CWebUser).IP = IP
      CType(CGlobali.Users.Item(i), CWebUser).Logged = True
      CType(CGlobali.Users.Item(i), CWebUser).StartSession = DateTime.Now.Ticks
      CType(CGlobali.Users.Item(i), CWebUser).WUTimer.Enabled = True
      Exit Sub
    End If
  Next

End Sub


This sub should start the timer WUTimer of the specified user, and indeed the property WUTimer.Enabled is set to True, but the sub WUTimer_Tick is never executed as if it is not connected to the Tick event of the timer.

Can some one help me?

Thanks in advance.

I think I made some dumb mistake but I can not find it.
AnswerRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
Pete O'Hanlon18-Sep-13 2:44
mvePete O'Hanlon18-Sep-13 2:44 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
steve_949661318-Sep-13 3:06
professionalsteve_949661318-Sep-13 3:06 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
Pete O'Hanlon18-Sep-13 3:26
mvePete O'Hanlon18-Sep-13 3:26 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
steve_949661318-Sep-13 3:37
professionalsteve_949661318-Sep-13 3:37 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
steve_949661318-Sep-13 23:11
professionalsteve_949661318-Sep-13 23:11 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
Pete O'Hanlon18-Sep-13 23:27
mvePete O'Hanlon18-Sep-13 23:27 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
steve_949661319-Sep-13 0:00
professionalsteve_949661319-Sep-13 0:00 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
Pete O'Hanlon19-Sep-13 0:09
mvePete O'Hanlon19-Sep-13 0:09 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
steve_949661319-Sep-13 1:39
professionalsteve_949661319-Sep-13 1:39 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
Pete O'Hanlon20-Sep-13 1:11
mvePete O'Hanlon20-Sep-13 1:11 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
steve_949661320-Sep-13 2:29
professionalsteve_949661320-Sep-13 2:29 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
steve_949661323-Sep-13 4:51
professionalsteve_949661323-Sep-13 4:51 
AnswerRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
Eddy Vluggen19-Sep-13 0:28
professionalEddy Vluggen19-Sep-13 0:28 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
steve_949661319-Sep-13 1:52
professionalsteve_949661319-Sep-13 1:52 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
Eddy Vluggen19-Sep-13 2:59
professionalEddy Vluggen19-Sep-13 2:59 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
steve_949661319-Sep-13 4:02
professionalsteve_949661319-Sep-13 4:02 
GeneralRe: [VB.NET 2008] A runtime created Timer doesn't work Pin
Eddy Vluggen19-Sep-13 4:57
professionalEddy Vluggen19-Sep-13 4:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.