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
Re: need code in net from vb 6.0
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.
Re: need code in net from vb 6.0
Re: need code in net from vb 6.0
So what does it do? What is the file? What kind of format?
Re: need code in net from vb 6.0
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
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?
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.
Re: need code in net from vb 6.0
I thought I knew, but no longer.
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 :eek2: but a desc. would have been nice :bigyello:
Re: need code in net from vb 6.0
But it's VB6, not .NET???
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
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.
Re: need code in net from vb 6.0
Try this:
VB 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
Re: need code in net from vb 6.0
Re: need code in net from vb 6.0
You put some elbow grease into that Dave. :D
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)
Re: need code in net from vb 6.0
Maybe we have to change this line:
VB Code:
piecessold As Long '4
valuesold As Long '4
to this line:
VB Code:
piecessold As Long '12
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?
Re: need code in net from vb 6.0
Re: need code in net from vb 6.0
Quote:
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?
Try something else.
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.
Re: need code in net from vb 6.0