Jump to content
Xtreme .Net Talk

Robby

Moderators
  • Posts

    3848
  • Joined

  • Last visited

Everything posted by Robby

  1. This returns the correct string as expected.. Diagnostics.Process.GetCurrentProcess.ProcessName but the rest does not.
  2. I just thought of something, since the sort is based on a client side click (or something) then why not in the New ie ... objDataView = New DataView(....) pass the sort order, and if the strMySortString is null or not a Postback you can set a default value for it.
  3. RowFilters will only filter by fields and criteria, I don't think you can do a sort with it.
  4. hmm, I just tested objDataView.Sort = strMySortString, and it does sort the dataview. Are you getting an error?
  5. Here's part of a sample from MSDN (or somewhere). It uses SQL Server (Pubs database) Place the Unzipped folder in your wwwroot updatesqltextbox.zip
  6. Do you mean changes to the value of the controls (ie textbox value) or to the controls themselves?
  7. It's possible that the object needs to be assessed only once.
  8. I would use method 1, but let's wait for a few of our resident gurus to weigh-in.
  9. Robby

    Simple or not?

    It's also in your .NET CD.
  10. Is there any way of ending the Worker Process, short of using the Task Manager? I did (finished) a project with asynchronous multi-threading and I kept an eye out on the thread count and the size of the process. The thread count worked as expected but the size of the aspnet_wp.exe sometimes grew to 300 megs. I invoked some better dispose methods and was able to contain it to less than 60 megs. Is there a way to kill the process or reduce the size after or once a page is loaded?
  11. I prefer giving the user two cells(textboxes) instead of only one. It's up to you how you want to tackle this. Of course you can parse the users' entry before you save it to the database, as well you can format it before displaying it back to the user. I made this function a while back, it re-formats user entered time into a proper time format, ie. the user enters 2:5 the function will adjust to 02:50 or if they enter 13:30 it re-format to 01:30. It would be recommended to place two radio buttons for AM and PM... Private Function ReFormatTime(ByVal strEntry As String) As String Try If IsDate(strEntry) And strEntry.IndexOf(":") >= 0 Then Dim sLeft As String = strEntry.Substring(0, 2) 'assign left 2 digits Dim sRight As String = strEntry.Substring(strEntry.Length - 2) 'assign right 2 digits If Not IsNumeric(sLeft) Then strEntry = "0" & strEntry 'pad left half with '0'. It must have been like this ... 2:36 If Not IsNumeric(sRight) Then strEntry = strEntry & "0" 'pad the right half with '0'. It must have been like this ... 02:3 'If the user thinks it's a 24 hour clock (military) If CType(strEntry.Substring(0, 2), Short) >= 13 Then 'this will adjust a 13:30 to 01:30...or a 23:00 to 11:00 strEntry = Format(CType(strEntry.Substring(0, 2), Short) Mod 12, "00") & ":" & strEntry.Substring(strEntry.Length - 2) End If 'if the user entered 00:nn If strEntry.Substring(0, 2) = "00" Then strEntry = "12:" & strEntry.Substring(strEntry.Length - 2) End If 'verify that the right half is not 02:60 (resulted from 02:6 being adjusted earlier) sRight = strEntry.Substring(strEntry.Length - 2) If CType(sRight, Short) > 59 Then 'we are here because the user entered 02:6 Return "" Else Return strEntry End If Else Return "" End If Catch Return "" 'in case of error we return a blank string End Try End Function
  12. There are much better ways of doing this, for now here's a simple example. Also, you need System.IO 'member vars... Private arr(,) As String Private m_Count As Integer = 0 Private Function OpenFile(ByVal strPath As String) As Boolean Dim sr As StreamReader sr = File.OpenText(strPath) Dim strItems As String 'loop through the text file While sr.Peek <> -1 strItems = sr.ReadLine() addArray(strItems) End While sr.Close() Return True 'file was there...with no errors End Function Public Sub addArray(ByVal strItems As String) Dim sTemp() As String = strItems.Split(","c) ReDim Preserve arr(3, m_Count) Dim x As Integer For x = 0 To 3 arr(x, m_Count) = sTemp(x) Next m_Count += 1 End Sub
  13. Can you post the code you have so far. I will try and plug in the what you need.
  14. Let's say you read a line... this Split is based on each item having a space in between words SomeLine = sr.ReadLine() myArray(nCounter) = SomeLine.Split(" "c) nCounter +=1
  15. I like 1 and 3, The home rental thing can get huge, an app on this type may help you in the business world.
  16. Well the data should be stored in 2 fields (StartTime and EndTime), then in the grid or a report you would use the SQL to merge the 2. ie. "SELECT (StartTime & " - " & EndTime) AS TotalTime...... Then use TotalTime as the field to display.
  17. Here's clue... Use the StreamReader to open a file and read its' contents, Then use the ReadLine method to read each line (while in a loop), In the loop, use the Split to place the contents of each line into an array. I really don't want to post any sample code as this is an assignment. Post back if you are stuck.
  18. I always use Option Strict On, the one time I did not was for this; I had a dozen RadioButtons, and I wanted to get the Tag value of the clicked item, so I added all of the handles into one click event and did this.... x = sender.Tag BTW, I started .NET 7 months ago, and last week I finished a 3 month contract using it.
  19. Oh, and On Error has left my vocabulary. and On Error Resume Next I almost never used in VB6. btw wyrd, for the short amount of time you've been in VB6/.NET, I find that you're quite advanced. Good job.
  20. For sure when you Throw, you are taxing your system. I ment for the occasions when all goes well and there are no exceptions, it's just because I use it a great deal, that's all.
  21. Compared to not using any Try/catch at all.
  22. On a slightly different note, does Try/Catch use more resources?
  23. I've been searching for benchmarks or opinions on which is best; convert, parse or ctype. Any opinions?
  24. or even Ctype()
  25. you could disable or invisible the child controls in a TabPage... Private Sub ChangeTextboxState(ByVal state As Boolean) Dim ctr As Control For Each ctr In tabPage1.Controls If TypeOf ctr Is TextBox Then ctr.Enabled = state End If Next end sub
×
×
  • Create New...