Jump to content
Xtreme .Net Talk

Xombie

Members
  • Posts

    6
  • Joined

  • Last visited

Xombie's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Actually, I got the reading part to work just fine. It's even faster than vb6 now. I did away with VBCompatability and made a few other changes and it's okay now. Oh, and I simply used ReadLine. Now my other question deals with writing a value. The chokepoint on that function is when I open & close a file to write. A simple 'sw = File.CreateText(inFile)' call slows the function down a lot. And closing the file does the a good bit of damage as well. Any pointers on writing a new file with StreamWritter without using file.createtext? Something faster maybe?
  2. Got a couple of questions on streamreader/filestream. For reference, I'm using vb.net ent arch 2003. 1. I'm on a US based windows 2000 install. I have a text file that I want to read. The text file could contain asian characters but should contain primarily ascii characters. I think I'm saying that right. Anyway, can I use.... Dim sr As StreamReader = New StreamReader(New FileStream(inFile, FileMode.Open), Encoding.Default, False, 4096) ... to read the file and still keep the asian characters intact? The part that's reading it is... Do While sr.ReadBlock(cBuffer, 0, cBuffer.Length - 1) > 0 bHold = Encoding.Default.GetBytes(cBuffer) sBuild.Append(Encoding.Default.GetString(bHold)) Loop ... where sBuild is a stringbuilder and bHold is a byte array. And yes, I did steal this stuff from the vbextreme example. 2. Is there a speedy way to break up the text into lines? From vbextreme the fella said ReadLine was slow so I'm using ReadBlock but then I still need to split the read text into lines and then parse it for certain text. Should I use ReadLine in this case or go for Split'ting the text and then looping through it? Update: I decided to change over to ReadLine since the routine I'm using is a custom INI file reader and I could shortcircuit it when I hit the value. Testing the VB.Net code against the original VB6 could of mine, it seems the VB.Net code is a little over twice as slow. Return a value in vb6 takes about 0.00105153 seconds while VB.Net return the same value in 0.002876901 seconds. The code is the same except I'm using... Dim sr As StreamReader = New StreamReader(New FileStream(inFile, FileMode.Open, FileAccess.Read, FileShare.Read), Encoding.Default) .... in VB.Net (along with ReadLine) rather than the VB6 Open For Input As/Line Input method. Is this normal or should I be doing something else in vb.net?
  3. Nuts. And I'm not so sure on importing that code because there was a little bit of complexity to it. A timer for subclassing, a couple classes & modules to it. Perhaps I could look for some sample code on filling a treeview with directories/files and just make a little form with what I need. I don't really *need* all that fancy shmancy filedialog stuff (back buttons, drop-down directory list, etc...) for just opening/saving files.
  4. I was able to get filedialog templates working in vb6 (via some code from abstractvb) and was wondering if there was an equivalent for vb.net 2003? Something to allow for extra controls directly on the filedialog control.
  5. Yar. I finally figured it out. I had to create a form variable that would hold the splitter.splitposition/the total height of the panel I was splitting. Whenever I resized, I'd reverse the formula and set the splitter.splitposition = total panel height*the variable. I had to do something similar in vb6 but I was hoping there was an easy, non-code way to do it here. I have to say the panels & docking & anchor thing is kinda neat. Takes a little getting used to but it's awful nice to not have to go through so much resize code.
  6. Howdy - I've got my form nice and set up to handle resizing & such. However, when I manually resize the form the splitter bar stays where it is. So, if I were to maximize the form, move the splitter bar way to the top and then restore the window, I can only see the 1 pane. The other one is off the screen. I'm using VB.Net 2003 and I'd figure this'd be one of those obvious things they'd make allowances for when they made the splitter control. Anyone run into this before and feel like sharing some tips?
×
×
  • Create New...