Click here to Skip to main content
15,867,308 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: about datagridview in vb.net ?? Pin
JohnPayton8-May-12 12:52
JohnPayton8-May-12 12:52 
GeneralRe: about datagridview in vb.net ?? Pin
Ahmad_kelany8-May-12 20:52
Ahmad_kelany8-May-12 20:52 
QuestionCombobox List population Pin
Carl J Shoup8-May-12 8:35
Carl J Shoup8-May-12 8:35 
AnswerRe: Combobox List population Pin
Jörgen Andersson9-May-12 4:04
professionalJörgen Andersson9-May-12 4:04 
AnswerRe: Combobox List population Pin
woopsydoozy9-May-12 4:51
woopsydoozy9-May-12 4:51 
Questionscreensaver fine tuning Pin
GPrime696-May-12 18:46
GPrime696-May-12 18:46 
AnswerRe: screensaver fine tuning Pin
Richard MacCutchan7-May-12 22:04
mveRichard MacCutchan7-May-12 22:04 
GeneralRe: screensaver fine tuning Pin
GPrime6910-May-12 17:39
GPrime6910-May-12 17:39 
i tried, but not successful. Maybe if i show the code i currently have to assist

Imports System.Timers
Imports System.Drawing

Public Class Form1
    Dim A As Int16 = 0

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PrevInstance()
        '  If PrevInstance() = True Then
        '    MessageBox.Show("sdfsdf")
        '   Close()
        '    End
        ' Else
        '  MessageBox.Show("222222")
        '  End If
        running()

        Dim startPoint1 As New Point(Me.Width / 2 - 165, 19)
        lbl_top.Location = startPoint1
        Dim startPoint2 As New Point(Me.Width / 2 - 62, 93)
        lbl_bottom.Location = startPoint2

        A = RandomNumber(0)
        Images()
        Timer1.Enabled = True
        Timer2.Enabled = True
    End Sub
    Function PrevInstance() As Boolean
        If UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0 Then
            MessageBox.Show("222222")
            Me.Close()
            Return True
        Else
            Return False
        End If
    End Function
    Private Sub Form_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, _
         ByVal X As Single, ByVal Y As Single)
        Static count As Integer
        If count > 2 Then
            Me.Close()
            End
        Else
            count = count + 1
        End If
    End Sub

    Public Sub running()
        'The end result of this code is similar to Visual Basic 6.0's App.Previnstance feature.
        Dim appName As String = Process.GetCurrentProcess.ProcessName
        Dim sameProcessTotal As Integer = Process.GetProcessesByName(appName).Length
        If sameProcessTotal > 1 Then
            MessageBox.Show("A previous instance of this application is already open!", " App.PreInstance Detected!", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Me.Close()
        End If
        appName = Nothing
        sameProcessTotal = Nothing

    End Sub
    Private Sub CreatePointsAndSizes(ByVal e As PaintEventArgs)
        ' Create the starting point.
        Dim startPoint As New Point(Me.Width / 2 - 331)
        ' Use the addition operator to get the end point.
        Dim endPoint As Point = Point.op_Addition(startPoint, _
            New Size(140, 150))
        ' Draw a line between the points.
        e.Graphics.DrawLine(SystemPens.Highlight, startPoint, endPoint)
        ' Convert the starting point to a size and compare it to the
        ' subtractButton size.  
        Dim buttonSize As Size = Point.op_Explicit(startPoint)
    End Sub
    Protected Overrides Function ProcessCmdKey(ByRef msg As Message, _
                               ByVal keyData As Keys) As Boolean
        ' spacebar to escape screensaver
        Const WM_KEYDOWN As Integer = &H100
        Const WM_SYSKEYDOWN As Integer = &H104

        If ((msg.Msg = WM_KEYDOWN) Or (msg.Msg = WM_SYSKEYDOWN)) Then
            Select Case (keyData)
                Case Keys.Space
                    Close()
            End Select
        End If

        Return MyBase.ProcessCmdKey(msg, keyData)
    End Function

    Private Sub Timer1_Tick(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Timer1.Tick
        Images()
    End Sub
    Private Sub Timer2_Tick(ByVal sender As System.Object, _
   ByVal e As System.EventArgs) Handles Timer2.Tick
        lbl_bottom.Visible = False
        lbl_top.Visible = False
        Timer2.Enabled = False

    End Sub
    Public Sub Images()

        If A = 1 Then
            Me.BackgroundImage = Screensaver_01.My.Resources.Resources._2011_06_07_IMG_2969_WM
            A = RandomNumber(1)
            Exit Sub
        End If
        If A = 2 Then
            Me.BackgroundImage = Screensaver_01.My.Resources.Resources._2011_06_28_IMG_4278_WM
            A = RandomNumber(2)
            Exit Sub
        End If
        If A = 3 Then
            Me.BackgroundImage = Screensaver_01.My.Resources.Resources._2011_08_03_IMG_9462_WM
            A = RandomNumber(3)
            Exit Sub
        End If
        If A = 4 Then
            Me.BackgroundImage = Screensaver_01.My.Resources.Resources._2011_08_21_Confidence_WM
            A = RandomNumber(4)
            Exit Sub
        End If
    End Sub
    Public Function RandomNumber(ByVal previous_number As Integer, _
    Optional ByVal MinNumber As Integer = 1) As Integer

        Dim randomObject As Random = New Random()
        Dim rndNum As Integer = previous_number
        Dim output As String = ""

        While previous_number = rndNum
            rndNum = randomObject.Next(1, 4)
        End While
        Return rndNum

    End Function
End Class

Questionhow to play videos from my database on my vb.net form.? Pin
romapatel6-May-12 4:01
romapatel6-May-12 4:01 
AnswerRe: how to play videos from my database on my vb.net form.? Pin
Eddy Vluggen6-May-12 6:06
professionalEddy Vluggen6-May-12 6:06 
Generalsaw Pin
m.alagushankar4-May-12 22:04
m.alagushankar4-May-12 22:04 
GeneralRe: saw Pin
Brandon-X120005-May-12 4:49
Brandon-X120005-May-12 4:49 
Questiontext box not filled in until you click on the tab page Pin
alejx4-May-12 18:11
alejx4-May-12 18:11 
AnswerRe: text box not filled in until you click on the tab page Pin
Eddy Vluggen6-May-12 6:03
professionalEddy Vluggen6-May-12 6:03 
QuestionList of "DO NOT TOUCH" Processes Pin
Brandon-X120004-May-12 13:00
Brandon-X120004-May-12 13:00 
AnswerRe: List of "DO NOT TOUCH" Processes Pin
Dave Kreskowiak4-May-12 13:53
mveDave Kreskowiak4-May-12 13:53 
GeneralRe: List of "DO NOT TOUCH" Processes Pin
Brandon-X1200018-May-12 7:12
Brandon-X1200018-May-12 7:12 
GeneralRe: List of "DO NOT TOUCH" Processes Pin
Dave Kreskowiak18-May-12 8:32
mveDave Kreskowiak18-May-12 8:32 
AnswerRe: List of "DO NOT TOUCH" Processes Pin
Luc Pattyn4-May-12 16:05
sitebuilderLuc Pattyn4-May-12 16:05 
AnswerRe: List of "DO NOT TOUCH" Processes Pin
Richard MacCutchan4-May-12 23:14
mveRichard MacCutchan4-May-12 23:14 
AnswerRe: List of "DO NOT TOUCH" Processes Pin
Philippe Mori5-May-12 1:37
Philippe Mori5-May-12 1:37 
QuestionI need a countdown timer that works in a VB ASP.net MVC3 app Pin
Member 84427504-May-12 3:32
Member 84427504-May-12 3:32 
AnswerRe: I need a countdown timer that works in a VB ASP.net MVC3 app Pin
Eddy Vluggen4-May-12 6:04
professionalEddy Vluggen4-May-12 6:04 
GeneralRe: I need a countdown timer that works in a VB ASP.net MVC3 app Pin
Member 84427504-May-12 6:15
Member 84427504-May-12 6:15 
GeneralRe: I need a countdown timer that works in a VB ASP.net MVC3 app Pin
Eddy Vluggen4-May-12 7:41
professionalEddy Vluggen4-May-12 7:41 

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.