PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
I really need help to convert this pseudocode to Visual Basic form please.-VBForums
Results 1 to 3 of 3

Thread: I really need help to convert this pseudocode to Visual Basic form please.

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2019
    Posts
    13

    I really need help to convert this pseudocode to Visual Basic form please.

    Pseudocode Solution:

    Black Code:
    1. PROCEDURE LineNumber(FileName:STRING, StartNumber:INTEGER, StepNumber:INTEGER)  
    2. DECLARE FileData:STRING
    3. DECLARE Count:INTEGER
    4. DECLARE Reply:CHAR
    5. DECLARE Continue:BOOLEAN
    6.  
    7. Count <-- 0
    8. Continue <--- TRUE
    9.  
    10. OPENFILE FileName FOR READ  //This is where i'm stuck, I don't know how to convert this and the next following lines to vb.net :((
    11. WHILE NOT EOF(FileName) AND Continue = TRUE
    12. READFILE FileName, FileData
    13. FileData <-- NUM_TO_STRING(StartNumber) & ":" & FileData
    14. OUTPUT FileData
    15. Count <-- Count + 1
    .
    .

    .
    Here's the question though:
    .Name:  Capture.jpg
Views: 187
Size:  47.2 KB
    .
    Last edited by CharonKharon; Aug 25th, 2019 at 05:27 AM.

  2. #2
    Frenzied Member ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    1,991

    Re: I really need help to convert this pseudocode to Visual Basic form please.

    here a routine to read a csv to a Datagridview

    the File has three fields and has a delimiter semicolon

    the Header columns are loaded in the Form_Load
    the file would look like this:

    1;Chris;A
    2;Charon;B

    etc....

    Code:
    Public Class Form2
    
        Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            With DataGridView1
                .Columns.Add("AdminID", "AdminID")
                .Columns.Add("Firstname", "Firstname")
                .Columns.Add("Lastname", "Lastname")
                'add the Columns you need
            End With
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            For Each line As String In System.IO.File.ReadAllLines("E:\XCsv.csv")
                DataGridView1.Rows.Add(line.Split(";"))
            Next
        End Sub
    End Class
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  3. #3
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    5,342

    Re: I really need help to convert this pseudocode to Visual Basic form please.

    You mentioned "Visual Basic Form", but it sounds like this should be a Console application.

    You open the file, read the first 20 lines, modifying the line and output to the console, then prompt if the user wants to continue. If they say yes, you do the next 20 lines.

    The second example here should be a starting point to the file I/O and output to the console. You'll need to add your additional requirements, to prompt the user for continuing. You don't show all the pseudo code, but I assume the pseudo code uses Count inside the loop to control the output and prompt, and continue the loop, if selected.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width