Skip to content

Visual Basic

Visual Basic Questions

This category can be followed from the open social web via the handle visual-basic@forum.codeproject.com

34.4k Topics 120.1k Posts
  • read line by line

    10
    0 Votes
    10 Posts
    0 Views
    D
    OK. It looks like that a String() is the best method then. It sounds like the problem you have now is the speed at which the string is read from or written to the file. I've come up with a partial implementation of a text editor with some code that is the fastest text file reader/writer that I can come up with. It reads/writes 500K in less than 0.05 seconds on my machine. Here's the code snippet for reading and writing the file: Private Sub mnuFileOpen\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileOpen.Click If ofdOpenFile.ShowDialog = DialogResult.OK Then fileName = ofdOpenFile.FileName Dim openFile As New StreamReader(fileName) txtEdit.Text = openFile.ReadToEnd() openFile.Close() End If End Sub Private Sub mnuFileSave\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileSave.Click If Not fileName.Equals(String.Empty) Then Dim saveFileWriter As StreamWriter = File.CreateText(fileName) Dim strReader As New StringReader(txtEdit.Text) saveFileWriter.Write(strReader.ReadToEnd) saveFileWriter.Flush() saveFileWriter.Close() strReader.Close() End If End Sub If you want the entire sample project, send me an email with an address to reply to. RageInTheMachine9532
  • I need help writing a script that will do the following

    com design sysadmin tools
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Excel, VB and Column formatting

    help tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    R
    Yeah - appreciate your help, but what I was after was something allong the following lines: oWorkSheet.Cells(lRow,lCol).Errors(xlNumberAsText).Ignore = True Thanks for the help tho....:-) "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox
  • Comparing the cells of DataGrid

    question
    2
    0 Votes
    2 Posts
    0 Views
    G
    Maybe you should check the cells before they are displayed in the datagrid. Usually there is a recordset or an array attached to it. It's easy to compare these. But perhaps this is not your question. Grtz, Guus
  • File properties dialog box

    json question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • web developement

    tutorial
    2
    0 Votes
    2 Posts
    0 Views
    M
    What books or articles have you already read/researched to learn about web development? What you're describing could be as simple as: 1) - create files in .avi, .mp3, .mov, or other video format 2) - store those files in a directory on a web server 3) - create simple html page (wouldn't really need asp.net for this) with MyFile kinds of tags.
  • Opening a Single Instance of MDI Child form Using VB.NET

    csharp help tutorial
    2
    0 Votes
    2 Posts
    1 Views
    M
    Hi. I'm not sure I understand what you mean. In your MDI application, are you clicking a menu item to instantiate a child form? If that's the case, then it should be simple in your parent form to maintain a private variable that can hold the child form. In the menu item code to open the child form, check if the private variable is nothing; if it is, set it to a new instance of your child form. If it isn't, then don't create a new child form instance, just use the Activate() method of the child form in the private variable to bring it to front. Something like this: ... Private _childForm as MyChildFormClass = nothing ... Private Sub OpenMyChildForm() If (_childForm Is Nothing) Then _childForm = new MyChildFormClass() _childForm.Show() Else _childForm.Activate() End If End Sub
  • Diary

    database design help announcement
    2
    0 Votes
    2 Posts
    0 Views
    M
    Hi Martyn. That is a very broad request for help. How new are you to programming in general, and to .NET programming in particular? Would you be helped at this point to get a list of recommended reading on the subject? As you go along, if you get to a specific point in your coding that is causing difficulty, or have a question about a more specific area in your development, post it and I'm sure folks will try to help. It's just a tough thing to answer such a broad question, beyond offering links you could visit or recommendations for books, that sort of thing.
  • How to use RtlMOveMemory in VB.NET?

    question csharp database tutorial
    2
    0 Votes
    2 Posts
    0 Views
    R
    In VB.6 you can use the generic copy memory routine such as Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _ (ByRef Destination As Any, ByRef Source As Any, ByVal numbytes As Long) VB.Net rejects the Any and won't work. You have to get more specific, such as Public Declare Sub CM_Integer_Byte Lib "Kernel32" Alias "RtlMoveMemory" _ (ByRef Destination As Integer, ByRef Source As Byte, ByVal Length AsInteger) Public Declare Sub CM_Short_Byte Lib "Kernel32" Alias "RtlMoveMemory" _ (ByRef Destination As Short, ByRef Source As Byte, ByVal Length As Integer) I have a bunch of these in my applications and they work well. RCarey RCarey
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    5 Posts
    0 Views
    B
    Getting access to the StdOut would be great, thank you very much ! *edit* Got it working now, thanks a bunch !
  • Notify Icon Question

    question
    2
    0 Votes
    2 Posts
    0 Views
    G
    You can implicitly open a form without showing it. I keep all pictures i use in one form and use them from there: Me.Icon = frmPictures.Icon or Me.tvwArticles.ImageList = frmPictures.imlNodePics2 Hope this helps Grtz, Guus
  • Killing a process in VB

    3
    0 Votes
    3 Posts
    0 Views
    A
    email me to send good program for you hmdfar@yahoo.com
  • HOw to save and scan an image

    tutorial
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • data extraction problem.

    database help tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    L
    thanx...i'll try it
  • 0 Votes
    2 Posts
    0 Views
    S
    i believe you should use a separate Connection for the separate thread. does that help? Regards, Serge (Logic Software)
  • Deployment

    debugging help csharp sysadmin
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • waveform plotting

    help tutorial question
    2
    0 Votes
    2 Posts
    0 Views
    R
    nobody loves me rIsHaBh
  • where to find the dialup info

    windows-admin help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied