|
-
Dec 5th, 2005, 08:58 AM
#1
Thread Starter
Fanatic Member
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
-
Dec 5th, 2005, 10:17 AM
#2
Re: need code in net from vb 6.0
-
Dec 5th, 2005, 11:12 AM
#3
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
 
-
Dec 5th, 2005, 12:42 PM
#4
Thread Starter
Fanatic Member
Re: need code in net from vb 6.0
P.S. God Love You And Have A Good Day!!! My web page
I need to get a free Iphone
-
Dec 5th, 2005, 03:25 PM
#5
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
 
-
Dec 5th, 2005, 04:15 PM
#6
Thread Starter
Fanatic Member
Re: need code in net from vb 6.0
P.S. God Love You And Have A Good Day!!! My web page
I need to get a free Iphone
-
Dec 5th, 2005, 04:48 PM
#7
Thread Starter
Fanatic Member
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
-
Dec 5th, 2005, 05:39 PM
#8
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
 
-
Dec 5th, 2005, 06:13 PM
#9
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.
-
Dec 5th, 2005, 06:20 PM
#10
Re: need code in net from vb 6.0
I thought I knew, but no longer.
My usual boring signature: Nothing
 
-
Dec 5th, 2005, 07:19 PM
#11
New Member
-
Dec 5th, 2005, 07:21 PM
#12
Re: need code in net from vb 6.0
But it's VB6, not .NET???
My usual boring signature: Nothing
 
-
Dec 5th, 2005, 08:00 PM
#13
Hyperactive Member
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"
-
Dec 5th, 2005, 08:07 PM
#14
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.
-
Dec 6th, 2005, 12:59 AM
#15
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
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.
-
Dec 6th, 2005, 01:13 AM
#16
Re: need code in net from vb 6.0
Brilliant!
-
Dec 6th, 2005, 01:18 AM
#17
Re: need code in net from vb 6.0
You put some elbow grease into that Dave.
-
Dec 6th, 2005, 04:41 AM
#18
Thread Starter
Fanatic Member
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
-
Dec 6th, 2005, 09:14 AM
#19
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?
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.
-
Dec 6th, 2005, 02:04 PM
#20
Thread Starter
Fanatic Member
Re: need code in net from vb 6.0
P.S. God Love You And Have A Good Day!!! My web page
I need to get a free Iphone
-
Dec 6th, 2005, 02:11 PM
#21
Hyperactive Member
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?
Try something else.
-
Dec 6th, 2005, 04:15 PM
#22
Re: need code in net from vb 6.0
 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.
-
Dec 6th, 2005, 06:20 PM
#23
Re: need code in net from vb 6.0
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|