Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. Dim a as string a=" This is a ""vb.net"" program"
  2. Anything you put in the session will survive for 20 minutes by default and is designed to maintain state between postbacks. If you do not require the object to persist over postbacks then there is no reason to use Sessions or any other form of state management - you could simply expose this collection as a property of the page / a shared class and allow access from multiple controls / modules. You may want to search the internet for information of the Model / View / Control pattern as a source of one possible method.
  3. What is the object in question and what data does it hold that makes it so large? If it is only used in the current postback why do you need to persist it between postbacks?
  4. Firstly you have quite a lot of VB6 stuff in there - why not just use Date.Now to get the current time rather than going through the Microsoft.VisualBasic.DateAndTime object? Also instead of providing comboboxes to select the date why not just drop a DateTimePicker control on a form and set it's format property to time; that way you do not have to worry about validating the time or handling 12 / 24 hour formats yourself.
  5. http://www.xtremedotnettalk.com/showthread.php?t=83092 is probably worth a read.
  6. Even better you may want to look at parameterising the query rather than relying on string concatenation, search these forums for reasons and examples.
  7. String.Compare allows you to specify if comparisons are done case sensitive or not.
  8. In .Net 2.0 there are a whole raft of new toolbar / menu features. Far far superior to the current ones. Amongst other things it fully supports icons and different rendering styles.
  9. http://www.xtremedotnettalk.com/showthread.php?t=69043 gives the source to a component that allows you to do this. There is no reason why you need to compile it to a dll though - add this code to your existing project instead.
  10. %WinDir% is a standard environment variable - you won't need to process the registry to find it. Just about every programming language / install tool has some method for evaluating these - what tool(s) are you looking at using to discover the existance (or not) of this directory?
  11. The code you posted wasn't doing what I suggested though you are doing panel10.Controls.Clear(); rather than panel10.CreateGraphics().Clear();
  12. You are still using concatenation to build your query - Post 5 above shows you the correct way to do this.
  13. If you use parameterised queries then you will not need to filter the input to prevent against injections.
  14. Your best bet is to investigate web services, that would allow you to expose programmatic objects via http.
  15. The method is marked private in your code sample - is that correct? If so then it will not be a public method.
  16. You could pass input as a string rather than object as .TryParse expects a string anyway.
  17. In the resize event have you tried private void Form1_Resize(object sender, System.EventArgs e) { panel10.CreateGraphics().Clear(); this.panel10.Invalidate(); }
  18. IIRC you can open and existing vc++ project in VS.Net and it will convert the project files over to the new format - however it will still compile to native C++ rather than .Net (plus you may need to fix errors due to it being a more 'standards' based compiler). Once upgraded you could always then try to compile with the /clr option to target the .Net runtime. Converting to C# or VB.Net will be a much harder prospect though.
  19. http://www.xtremedotnettalk.com/showthread.php?t=73223
  20. IIRC VS 2005 comes with an updated version of VSS - although I would be careful of upgrading an existing VSS installation to a beta version. However you should be able to use the standalone VSS client with a VS 2005 project.
  21. Just out of interest what is generating the file in the first place? Also instead of just looping in a timer you could use a FileSystemWatcher component from the toolbar to notify you on changes to the file. Also rather than reading the file line by line you could do a sr.ReadToEnd() to read the entire file into memory in one hit andthen process it. Possibly even skipping to the last read line and only appending new data to the textbox rather than reloading the entire thing. Although it won't solve your problem you might want to replace some of the VB6 code (Dir etc) with the .Net equivalent Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'check to see if file exists if so delete and recopy If File.Exists("C:\access2.log") Then File.Delete("C:\access2.log") End If System.IO.File.Copy("C:\access.log", "C:\access2.log") 'copy file because its in use 'end check Timer1.Enabled = False End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim fileDetails_new As FileInfo = New FileInfo("C:\access2.log") Dim fileDetails_reg As FileInfo = New FileInfo("C:\access.log") If fileDetails_new.Length.ToString() <> fileDetails_reg.Length.ToString() Then Dim sr As StreamReader = New StreamReader("C:\access2.log") Dim line As String Do 'looping reading each line at a time line = sr.ReadLine() If TextBox1.Text = "" Then 'make sure you dont have a blank line at start TextBox1.Text = line.Substring(1, 13) Else TextBox1.Text = TextBox1.Text & vbCrLf & line.Substring(1, 13) End If Loop Until line = Nothing 'loop until the end Me.Show() 'set the caret and redraw to scroll to bottom TextBox1.SelectionStart = TextBox1.Text.Length TextBox1.ScrollToCaret() sr.Close() 'close the streamreader End If End Sub Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing File.Delete("C:\access2.log") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer1.Enabled = True End Sub
  22. What version of the framework is the app running on? If you are using 1.1 then that is the framework installed with 2003 server anyway. Clicky is the msdn page for DataTable.Select and it doesn't mention anything about it being depreciated as a method...
  23. From Visual Studio you can't, however using the command line tools it's possible to compile both vb and C# code to a module and then link multiple modules into a single assembly. Is there a reason why you need to use both languages in a single project?
  24. using Project.NewClass
  25. If you step through in a debugger is rs being set to anything in the load_data method? Also is there a reason you are using ADO code rather than ADO.Net code?
×
×
  • Create New...