Results 1 to 15 of 15

Thread: Edneeis - About your "Tips at Startup" progam

  1. #1

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435

    Talking Edneeis - About your "Tips at Startup" progam

    Edneeis, I've just visited your excellent website and discovered your "Tips at Startup" program, which is exactly what I would like to have in my VBCodebook .NET program.

    Firstly, can I have your permission to include it? Secondly, is there a way you can modify it slightly to include bold italic and underline in the main tips body?

    Also, could it be possible, when clicking the Next Tip button, to move onto the next tip in the list instead of picking a random one each time? Perhaps picking a random tip at the beginning and moving on to the next one, eventually looping round? This way, ALL the tips will be guarenteed to be seen.

    Thanks Edneeis
    Last edited by RealNickyDude; Jan 16th, 2003 at 09:30 AM.
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Thanks. Sure you can use it. Here is an updated copy that can show richtext or text and can next random or not. The random bit is set by an internal const NextIsRandom and in this example is set to be NOT random. As for the bold, underline bit if you want it to show like that you have to put RichText in the tip instead of normal text. If it can't read it then it shows it as regular text and this is only on the body the headed format can't be changed dynamically.

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Opps I forgot to post the zip. I'll update the website one when I get home but this is the samething.

  4. #4

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    Wow, thanks Edneeis! Just what I needed

    Just a couple of questions:

    1/. How do load RichText? How do I change it from reading an xml doc to a richtext doc?
    2/. How would I go about displaying a random tip first (instead of the first tip) and then move to the next tip from there?

    E.g: Pick a random tip at start, say, tip 4, out of 10, then clicking Next will take you to tip 5 then 6..... 9, then 10
    , then back to 1 again.

    Again, thanks Edneeis.
    Last edited by RealNickyDude; Jan 16th, 2003 at 03:31 PM.
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  5. #5

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    I've added code that tells you what tip your on, out of the number of tips there is (in bold). For anyone who's interested.
    VB Code:
    1. If NextIsRandom Then
    2.                 rndRow = Int(((ds.Tables(0).Rows.Count - 1) - 0 + 1) * Rnd() + 0)
    3.             Else
    4.                 rndRow += 1
    5.             End If
    6. [b]
    7.             'Display tip number out of how many tips in titlebar
    8.             Me.Text = "Tip of the day - Tip " & rndRow _
    9.             & " out of " & ds.Tables(0).Rows.Count
    10. [/b]
    11.             'handle outside of count
    12.             If rndRow > ds.Tables(0).Rows.Count - 1 Then rndRow = 0
    13.             If rndRow < 0 Then rndRow = ds.Tables(0).Rows.Count - 1
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  6. #6

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    I've added a link to your website Edneeis from within VBCodebook .NET: Beta Release 6, is that ok?
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    The answer to question #1 is you don't. You still use an xml document so it can load into the dataset but you can put richtext into the Body node of the xml. You can write richtext with word, wordpad, or any other number of rtb applications. If you use Word just make sure and save it as RichText then just cut and past it in there. Or if you are using a RichTextBox then use the RTF property instead of the Text property.

    As for #2 at the form load you can i'll post an update tonight. But you basically switch the IsNextRandom to a variable instead of a Constant and then change it after the first tip is loaded.

    Also sure you can link to my site.

  8. #8

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    I'm not sure i'm with you on question 1. Do I load up an rtf document into a text editor to see all the rtf codes, then copy and paste that?
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  9. #9
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Yes you can do it that way. Or if you use wordpad to write the stuff how you want then open the file in notepad and copy and paste that (which will be the rtf codes also). Either way as long as the Body has the rtf codes then its all good.

    Here is an updated example also.

  10. #10

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    Edneeis, I don't know whether you'll be interested but I've updated your program to include Previous Tip to go backward through the tips and to show the tip number out of the number of tips available (properly), here's the code (italics is the update i've added):

    VB Code:
    1. [i]Dim Previous As Boolean[/i]
    2.  
    3.     Private Sub NextTip(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
    4.         'load the next tip NOT random
    5.         [i]Previous = False[/i]
    6.         FillTip(False)
    7.         rtbBody.Focus()
    8.     End Sub
    9.  
    10.     [i]Private Sub PrevTip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrevTip.Click
    11.         'load the next tip NOT random
    12.         Previous = True
    13.         FillTip(False)
    14.         rtbBody.Focus()
    15.     End Sub[/i]
    16.  
    17.     Private Sub FillTip(ByVal Random As Boolean)
    18.  
    19.         Try
    20.             lblHeading.Image = ilsMain.Images(TipImageIndex).Clone
    21.             'choose tip random or next
    22.             Static rndRow As Integer
    23.             If Random Then
    24.                 Randomize()
    25.                 rndRow = Int(((ds.Tables(0).Rows.Count - 1) - 0 + 1) * Rnd() + 0)
    26.            [i] ElseIf Previous = False Then
    27.                 rndRow += 1
    28.             Else
    29.                 rndRow -= 1
    30.             End If[/i]
    31.  
    32.             'handle outside of count
    33.             If rndRow > ds.Tables(0).Rows.Count - 1 Then rndRow = 0
    34.             If rndRow < 0 Then rndRow = ds.Tables(0).Rows.Count - 1
    35.  
    36.            [i] 'Display tip number out of how many tips in titlebar
    37.             Me.Text = "Quick Tips - Tip " & rndRow + 1 _
    38.             & " out of " & ds.Tables(0).Rows.Count[/i]
    39.  
    40.             Dim dr As DataRow = ds.Tables(0).Rows(rndRow)
    41.             lblHeading.Text = dr.Item("Heading")
    42.             Try
    43.                 rtbBody.Rtf = dr.Item("Body")
    44.             Catch
    45.                 'tip is text not rtf
    46.                 rtbBody.Text = dr.Item("Body")
    47.             End Try
    48.  
    49.         Catch eIndex As IndexOutOfRangeException
    50.             'there are no tips
    51.             lblHeading.Image = ilsMain.Images(ErrorImageIndex).Clone
    52.             lblHeading.Text = "There are no tips available!"
    53.             rtbBody.Text = "Make sure that there is data in the Tips.xml in the application folder."
    54.         Catch ex As Exception
    55.             'unknown error
    56.             MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected Error")
    57.         End Try
    58.  
    59.     End Sub
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  11. #11
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Thank you very much I'll update the sample with a thank you on my website. I noticed the # of # from the screen of your app and thought that was a good idea, too.

  12. #12

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    You wouldn't believe that I only bought VB.NET just before Christmas and didn't even know how to exit an app! I've surprised myself
    Last edited by RealNickyDude; Jan 22nd, 2003 at 05:51 PM.
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  13. #13

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    Edneeis, no matter how many different ways I try, I can't seem to get it to accept RichText, it either gives me errors saying that tags are missing form xml, or it shows the actual tags instead of interperating them.

    Any suggestions on how to incorporate RichText into the 'Tip of the Day' would be most useful.

    Thanks.
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  14. #14
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Well I'm not sure what you are doing wrong, it works for me. One thing to remember is that a full rtf document has to be in there not just a paragraph or whatever. This is due to the rtf format having font and misc information stored in the header. If the code is how I showed you then try this tip.xml.

  15. #15

    Thread Starter
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    Thanks Edneeis, i've sussed out what I was doing wrong, I was loading the entire xml document into Wordpad and saving that instead of the individual tips (doh )
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

Posting Permissions

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



Click Here to Expand Forum to Full Width