Results 1 to 23 of 23

Thread: need code in net from vb 6.0

  1. #1

    Thread Starter
    Fanatic Member bob5731's Avatar
    Join Date
    Nov 2004
    Posts
    918

    Angry need code in net from vb 6.0

    Hi
    I am new to vb.net

    Code:
    TYPE stocktable
        descript AS STRING * 24
        PRICE AS STRING * 7
        category AS STRING * 1
        taxtype AS STRING * 1
        piecessold AS LONG '4
        valuesold AS LONG '4
        vendorid AS STRING * 1
        inventorycount AS STRING * 4
        STOCKNUMBER AS STRING * 18
        cost AS LONG '4
        model AS LONG '4
        pack AS LONG '4
        vendorstock AS STRING * 30
        saleprice AS LONG '3
        junk AS STRING * 10
    END TYPE
     
    DIM SL#(60, 4)
    'A#(X,4) = rec.PRICE
    INPUT A#
    Y = 1
    'IF KeyAscii = 13 THEN
    DIM STOCKNUMBER AS STRING
    OPEN "c:\pos\bob.tbl" FOR RANDOM AS #1 LEN = 120
    FOR X% = 2 TO 13001
        GET #1, X%, rec
        IF VAL(STOCKNUMBER) = A# THEN A#(Y, 4) = VAL(PRICE)
        END IF
    NEXT X%
    CLOSE #1
    END IF
    PRINT A#(Y, 4)
     
    'Now for each line of the sale put the description in SL$(X)
    'Pieces in SL@(X,2)
    'Tax rate in SL@(X,3)
    'Price in SL@(X,4)
    'PRICE% is shorter that intPrice
    'IF VAL(STOCKNUMBER) = A# THEN A#(X,4) = PRICE
    END IF
    P.S. God Love You And Have A Good Day!!!My web page

    I need to get a free Iphone

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Re: need code in net from vb 6.0

    Im not
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: need code in net from vb 6.0

    So, what are you after here? That code looks almost like old QBASIC. Why all caps?

    Anyways, that's irrelevant. You might try the conversion wizard for something as small as that. It really sucks, but it would give you some insights.

    However, the conversion wizard is pretty bad. Therefore:

    The Type that you define would be an excellent candidate to be turned into a class or structure. Those two behave somewhat differently, and you'd have to think them over to decide which is best. However, I would suggest a structure. I prefer to use classes when I have many private member variables or many functions. Since you may have no member functions, and all the member variables are public, a structure would be the better choice.

    Alternatively, you could make all the members private and expose them through properties. This is the more stylish approach, but in this case it would take more time, and might offer you no advantage (unless there was some formatting and the like that you would want to add to the property).

    Having looked at the rest of the code, I'm not sure what to say. You open a .tbl file. That sure looks like table, but what is it? If the file is a text file, you will want to look into filestreams and streamreaders. Alternatively, if this is just a file based pseudo-database, you might ignore everything I mentioned before and use a dataset with a table in it in place of the structure I suggested. Then, you should be able to use ADO.NET to read the file into the dataset.
    My usual boring signature: Nothing

  4. #4

    Thread Starter
    Fanatic Member bob5731's Avatar
    Join Date
    Nov 2004
    Posts
    918

    Re: need code in net from vb 6.0

    It is in qbasic.
    P.S. God Love You And Have A Good Day!!!My web page

    I need to get a free Iphone

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: need code in net from vb 6.0

    So what does it do? What is the file? What kind of format?
    My usual boring signature: Nothing

  6. #6

    Thread Starter
    Fanatic Member bob5731's Avatar
    Join Date
    Nov 2004
    Posts
    918

    Re: need code in net from vb 6.0

    Table File for dhpos.
    P.S. God Love You And Have A Good Day!!!My web page

    I need to get a free Iphone

  7. #7

    Thread Starter
    Fanatic Member bob5731's Avatar
    Join Date
    Nov 2004
    Posts
    918

    Angry Re: need code in net from vb 6.0

    Code:
    Public Type stocktable
        descript As String * 24
        Price As String * 7
        category As String * 1
        taxtype As String * 1
        piecessold As Long '4
        valuesold As Long '4
        vendorid As String * 1
        inventorycount As String * 4
        STOCKNUMBER As String * 18
        cost As Long '4
        model As Long '4
        pack As Long '4
        vendorstock As String * 30
        saleprice As Long '3
        junk As String * 10
    End Type
    Public rec As stocktable
    Public STOCKNUMBER As String
    
    Private Sub txtStockNum_KeyPress(KeyAscii As Integer)
      If newlist = True Then
         ReDim LastCost(0) As Currency
         LstTicket.Clear
         subtotal = 0
         TotalCost = 0
         txtSubTotal.Caption = ""
         newlist = False
      End If
      If KeyAscii = 13 Then
        ff = FreeFile
    '    Open App.Path & "\" & FileTBL For Random As #ff Len = 120
        Open FileTBL For Random As #ff Len = 120
        For X = 2 To 13001
          Get #1, X, rec
          If RTrim$(LTrim$(rec.STOCKNUMBER)) = RTrim$(LTrim$(txtStockNum.Text)) Then
             txtPrice.Text = Format(rec.Price / 100, "$ ###.00")
             ItemPrice = rec.Price / 100
             txtDescription.Text = rec.descript
             txtTaxRate = TaxRate * 100 & " %"
          End If
        Next X
        Close #1
      End If
    End Sub
    P.S. God Love You And Have A Good Day!!!My web page

    I need to get a free Iphone

  8. #8
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: need code in net from vb 6.0

    That doesn't look much like .NET. It looks like VB6. Is that what you are headed for? Does it work?
    My usual boring signature: Nothing

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: need code in net from vb 6.0

    I love these posts with next to no information. They create such an air of mystery about what on earth you're doing and what on earth you want us to do about it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: need code in net from vb 6.0

    I thought I knew, but no longer.
    My usual boring signature: Nothing

  11. #11
    New Member ibmsystems's Avatar
    Join Date
    Dec 2005
    Posts
    1

    Wink Re: need code in net from vb 6.0

    Well The Code That bob5731 placed i think is the stock table code for his pos for windows a DHPOS imatation but a desc. would have been nice

  12. #12
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: need code in net from vb 6.0

    But it's VB6, not .NET???
    My usual boring signature: Nothing

  13. #13
    Hyperactive Member
    Join Date
    Mar 2005
    Location
    Bath, England
    Posts
    411

    Re: need code in net from vb 6.0

    It's actually in QBASIC and he wants it converted to .NET. I say, do it yourself. At least make an effort before you come demanding help from others.

    Forum search
    MSDN
    Google
    "Make it idiot-proof and someone will make a better idiot"

  14. #14
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: need code in net from vb 6.0

    If you don't know how to do it then asking for help is OK I think, but a polite request would be the way to go. We're all volunteering our time and effort so the least you could do is make it seems as though it's appreciated. An angry icon with a blunt statement that doesn't even relate properly to the scant infomation provided doesn't make me feel appreciated, nor do the curt responses when prompted for more information.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  15. #15
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: need code in net from vb 6.0

    Try this:

    VB Code:
    1. Public Type stocktable
    2.     descript As String * 24
    3.     Price As String * 7
    4.     category As String * 1
    5.     taxtype As String * 1
    6.     piecessold As Long '4
    7.     valuesold As Long '4
    8.     vendorid As String * 1
    9.     inventorycount As String * 4
    10.     STOCKNUMBER As String * 18
    11.     cost As Long '4
    12.     model As Long '4
    13.     pack As Long '4
    14.     vendorstock As String * 30
    15.     saleprice As Long '3
    16.     junk As String * 10
    17. End Type
    18. Public rec As stocktable
    19. Public STOCKNUMBER As String
    20.  
    21. Private Sub txtStockNum_KeyPress(KeyAscii As Integer)
    22.   If newlist = True Then
    23.      ReDim LastCost(0) As Currency
    24.      LstTicket.Clear
    25.      subtotal = 0
    26.      TotalCost = 0
    27.      txtSubTotal.Caption = ""
    28.      newlist = False
    29.   End If
    30.   If KeyAscii = 13 Then
    31.     ff = FreeFile
    32. '    Open App.Path & "\" & FileTBL For Random As #ff Len = 120
    33.     Open FileTBL For Random As #ff Len = 120
    34.     For X = 2 To 13001
    35.       Get #1, X, rec
    36.       If RTrim$(LTrim$(rec.STOCKNUMBER)) = RTrim$(LTrim$(txtStockNum.Text)) Then
    37.          txtPrice.Text = Format(rec.Price / 100, "$ ###.00")
    38.          ItemPrice = rec.Price / 100
    39.          txtDescription.Text = rec.descript
    40.          txtTaxRate = TaxRate * 100 & " %"
    41.       End If
    42.     Next X
    43.     Close #1
    44.   End If
    45. End Sub
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  16. #16
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: need code in net from vb 6.0

    Brilliant!

  17. #17
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: need code in net from vb 6.0

    You put some elbow grease into that Dave.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  18. #18

    Thread Starter
    Fanatic Member bob5731's Avatar
    Join Date
    Nov 2004
    Posts
    918

    Angry Re: need code in net from vb 6.0

    Is not working for me
    Code:
    Public Type stocktable
        descript As String * 24
        Price As String * 7
        category As String * 1
        taxtype As String * 1
        piecessold As Long '4
        valuesold As Long '4
        vendorid As String * 1
        inventorycount As String * 4
        STOCKNUMBER As String * 18
        cost As Long '4
        model As Long '4
        pack As Long '4
        vendorstock As String * 30
        saleprice As Long '3
        junk As String * 10
    End Type
    Public rec As stocktable
    Public STOCKNUMBER As String
    
    Private Sub txtStockNum_KeyPress(ByVal KeyAscii As Integer)
    P.S. God Love You And Have A Good Day!!!My web page

    I need to get a free Iphone

  19. #19
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Angry Re: need code in net from vb 6.0

    Maybe we have to change this line:

    VB Code:
    1. piecessold As Long '4
    2.     valuesold As Long '4

    to this line:

    VB Code:
    1. piecessold As Long '12
    2.     valuesold As Long '13

    You should be more speceific than "It's not working". That doesn't tell anybody anything. That is like going to the doctor and saying: "Please give me some medicine cause I don't feel healthy". What medicine do you think you would get?
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  20. #20

    Thread Starter
    Fanatic Member bob5731's Avatar
    Join Date
    Nov 2004
    Posts
    918

    Re: need code in net from vb 6.0

    not work yet.
    P.S. God Love You And Have A Good Day!!!My web page

    I need to get a free Iphone

  21. #21
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    394

    Re: need code in net from vb 6.0

    You should be more speceific than "It's not working". That doesn't tell anybody anything. That is like going to the doctor and saying: "Please give me some medicine cause I don't feel healthy". What medicine do you think you would get?
    not work yet.
    Try something else.

  22. #22
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: need code in net from vb 6.0

    Quote Originally Posted by bob5731
    not work yet.
    You need to move that line of code to replace that other line of code and change that variable type to Integer.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  23. #23
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: need code in net from vb 6.0

    Not care yet.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

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



Click Here to Expand Forum to Full Width