Jump to content
Xtreme .Net Talk

Robby

Moderators
  • Posts

    3848
  • Joined

  • Last visited

Everything posted by Robby

  1. Remove my error checking and comments, you're left with a few lines of code. As divil said, there's not much difference.
  2. try this out... Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles ComboBox1.SelectedIndexChanged Select Case ComboBox1.Text.ToString Case "test 1" 'Do something Case "test 2" 'Do something Case "test 3" 'Do something End Select End Sub Private Sub form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.Items.Add("test 1") ComboBox1.Items.Add("test 2") ComboBox1.Items.Add("test 3") End Sub
  3. There are many ways to read/write files, here's one. You need one List Box on your form. Private Function GetFromFile() As Boolean Try List1.Items.Clear() 'Clear the list before we can load from the text file Dim sr As StreamReader sr = File.OpenText(Application.StartupPath & "\Test.txt") Dim strItems As String 'loop through the text file While sr.Peek <> -1 strItems = sr.ReadLine() List1.Items.Add(strItems) 'add the contents to the list box End While sr.Close() 'close the file Return True 'file was there...with no errors Catch 'ignore errors Return False 'most likely we don't have file permission (to delete) End Try End Function Private Function SaveToFile() As Boolean Try Dim bFile As String = Dir(Application.StartupPath & "\Test.txt") If bFile.Length > 0 Then 'Check if the file exists and delete it Kill(Application.StartupPath & "\Test.txt") End If 'Create the file again or for the first time Dim sb As New FileStream(Application.StartupPath & "\Test.txt", FileMode.OpenOrCreate) Dim sw As New StreamWriter(sb) Dim nCounter As Integer 'loop through the list and save one line at a time For nCounter = 0 To List1.Items.Count - 1 sw.Write(List1.Items.Item(nCounter).ToString & vbCrLf) Next sw.Close() Return True Catch 'ignore errors Return False End Try End Function
  4. Robby

    Background Alarm

    You do know that your application will still need to continue running, right? I guess that you're using an timer for the alarm... When time is up, just show the form or message box you want.
  5. Is it just as slow when you run the exe from the Release Bin. (without the IDE)
  6. I'm sure there's a better and shorter solution. This is really messy and long but it works. 'Declare these at the top of your page (inside the Class) Private intCounter As Integer = 0 Private intSeconds As Integer = 0 Private intMinutes As Integer = 0 Private intHours As Integer = 0 'here goes.... Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.Text = FormatCounter() End Sub Private Function FormatCounter() As String Dim sTemp As String If intCounter < 60 Then intSeconds = intCounter Else intMinutes += 1 intCounter = 0 intSeconds = 0 End If If intMinutes >= 60 Then intSeconds = 0 intCounter = 0 intMinutes = 0 intHours += 1 End If intCounter += 1 If intHours < 10 Then sTemp = "0" & intHours.ToString & ":" Else sTemp = intHours.ToString End If If intMinutes < 10 Then sTemp = sTemp & "0" & intMinutes.ToString & ":" Else sTemp = sTemp & intMinutes.ToString End If If intSeconds < 10 Then sTemp = sTemp & "0" & intSeconds.ToString Else sTemp = sTemp & intSeconds.ToString End If Return sTemp End Function
  7. Nope. Instead you can add multiple Handles to your events
  8. Robby

    Calender Object

    We do have an ASP.NET section too.
  9. Sorry but one more correction, no part of .NET is anything like VBA.
  10. Place a Property Get/Set in frm2, Set its' value before you open frm2 then in the New or Load of frm2 Get the Index from the Property.
  11. With all the software requirements like IE6, IIS5, the Frameworks, etc... you will need at least 1 gig. and 512 RAM wouldn't hurt.
  12. Are you trying to reset a ListBox? If so .....ListBox1.Items.Clear()
  13. try GetSelected()
  14. Robby

    Calender Object

    I'm assuming that you're using the MonthCalendar Control.... Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged MessageBox.Show(e.Start.Month.ToString & "/" & e.Start.Day.ToString & "/" & e.Start.Year.ToString) End Sub
  15. try this... ".... and LIKE '%" & TextBox1.Text & "%') ORDER ...."
  16. What method are you using for the databind?
  17. A lot of the errors you may get using Option Strict is implicit casting, so just make all your catsing explicit. (and you're halfway there)
  18. I'm not sure I understood, do you need to do this with MS Access?
  19. Here's an example... AMCE Company has a web service, it decides to offer its customers the current sales tax rate for their state. subscribers (other companies) can have their shopping-cart go to the web service look-up the tax rate by passing a parameter such as state and the web-service would return the current tax rate for that state.
  20. Robby

    Help!!!

    I don't get it. Do you want to know how to delete items from a list box? So what is your second post all about? If it's another question, it would be better served in a new thread. [edit]I see now that you didn't have a second post, it was just an extremely large signature with code in it. Ugh...[/edit]
  21. Robby

    Help!!!

    What do you have (as code) so far.
  22. A Class.VB and a Form.VB is exactly the same thing only the Class doesn't Import the Windows.Forms... I can't see why you wouldn't be able to create a Class.
  23. I did read somewhere that C# is 3 to 10% faster in some case than VB.NET. BTW, you can put C# and VB.NET code in the same solution.
  24. Robby

    .net Framework

    I think that he wants to know how to package the Frameworks. I would tell you, but I haven't packaged anything yet.
×
×
  • Create New...