Does anyone know how to create a tip of the day dialog for VB 2005. the examples that I've found so far do not work.


Recommended Answers

All 6 Replies

Here is a quick I put together. If doesn't do much but will show you what to do.

Thanks Wayne but not exactly what I'm looking for. I need the code to read from a text file.


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        RichTextBox1.Text = ""
        OpenFileDialog1.Filter = "all files|*.*"
        Dim reader As StreamReader
        If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            reader = New StreamReader(OpenFileDialog1.FileName)
            Do While Not reader.EndOfStream
                RichTextBox1.Text &= reader.ReadLine & vbNewLine
        End If
    End Sub


Close but not there yet. I don't need to browse for a file using the openfiledialog control. What I actually need is to read a text file and display one line at a time from the text file into a listbox. Also I need to have this Tip of the day box come up automatically if the Show Tips at Startup checkbox is checked.



Alright, lets try this then:

Imports System.IO

Public Class Form1
    Dim ary As New ArrayList

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim reader As New StreamReader("c:\test.txt")
        Do While Not reader.EndOfStream
            ary.Add(reader.ReadLine & vbNewLine)
        If Me.CheckBox1.Checked Then
            Dim rn As New Random
            Label1.Text = ary(rn.Next(0, ary.Count - 1))
        End If
    End Sub
End Class

Here is a short project showing a tip of the day.

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.