I am a total beginner that happens to own a copy of visual studio pro 2005. Would like to get a glue as to how to get the basics and advance myself. Is there anything on the daniweb site to guide novices to at least get a concept of how to proceed? No time to take a course at the moment. Looking for a way to self teach.

Dani AI

Generated

A compact, practical plan for turning the idea in this thread into a working prototype — and a short VB.NET pattern you can drop into a Smart Device form to detect short button sequences. This builds on the learning path mentioned earlier by and the resource suggestions from and .

Start small and verify on emulator then hardware. Implement an event-driven detector: set the form to receive keys first, handle KeyDown, keep a short rolling buffer of Keys with timestamps, and match the tail of that buffer against the target pattern. This keeps the UI responsive and makes the logic easy to test. Note that mapping of physical keys can differ between emulator and handset, and that detecting keys while your app is not foregrounded typically requires platform-specific/native techniques beyond simple Form events.

A minimal VB.NET example (Compact Framework) showing the main idea:

Private keySeq As New List(Of Keys)()
Private lastKeyTime As DateTime = DateTime.MinValue
Private Const SEQ_WINDOW_MS As Integer = 1500
Private targetSeq As Keys() = New Keys() {Keys.Left, Keys.Right, Keys.Left}

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    Me.KeyPreview = True
End Sub

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyDown
    Dim now As DateTime = DateTime.UtcNow
    If (now - lastKeyTime).TotalMilliseconds > SEQ_WINDOW_MS Then
        keySeq.Clear()
    End If
    keySeq.Add(e.KeyCode)
    lastKeyTime = now

    If keySeq.Count >= targetSeq.Length Then
        Dim match As Boolean = True
        For i As Integer = 0 To targetSeq.Length - 1
            If keySeq(keySeq.Count - targetSeq.Length + i) <> targetSeq(i) Then
                match = False : Exit For
            End If
        Next
        If match Then
            keySeq.Clear()
            MessageBox.Show("Sequence detected")
        End If
    End If
End Sub

Troubleshooting tips: if KeyDown never fires, ensure KeyPreview = True and that the form has focus; try the emulator keypad to confirm mapping; log raw KeyCode values when testing on real hardware. If global/background detection is required, plan for native interop or a small resident native component — that is a deeper platform topic.

Recommended Answers

All 3 Replies

If you are a total beginner, the book "Visual Basic 2005 step by step" by Microsoft Press is very good. I used that (but the 2002 version) to teach myself.

mnewsome,

Beginning Object-Oriented Programming with VB 2005: From Novice to Professional by Apress is a very good book. Actually had it sitting right here on my desk when I saw this question. You may be able to find a more up to date edition.

Much thanks for the response. As I search for this book please note that I have since been given a copy of VS 2008 Team Suite. My project would involve smartphones. I have downloaded the SDK for mobie 6. I would like the smartphone take note of unique sequences of 'pushed buttons' to perform specific tasks. How much of a project am I looking at? I can find no literature on how to commence on such an effort. Much thanks for any informed guidance you can provide.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.