Posts: 42
Threads: 15
Joined: Jun 2004
hey, 1st, why do i get an error when i run this? and how can i not use numbers as records but instead names. better yet haw can i save things in catagories and display whole catagories at one time? how would i implement an erasing a frequency tool in there, its a database program to store my millitary HF frequencies.
edit : sorry on the spelling^^ :bounce:
Code:
' DEVELOPED AND CREATED BY HAMFREAK2002
TYPE freq
fq AS LONG
nm AS STRING * 60
dis AS STRING * 80
END TYPE
DIM channel AS freq
mm:
PRINT "1) Add a record"
PRINT "2) View a record"
PRINT "3) Quit"
INPUT "What would you like to do "; mmchc$
IF mmchc$ = "1" THEN GOTO addrec
IF mmchc$ = "2" THEN GOTO viewrec
IF mmchc$ = "3" THEN END
addrec:
OPEN "freqprog,dat" FOR RANDOM AS #1
INPUT "Record"; record
INPUT "Frequencey"; channel.fq
INPUT "Name of station"; channel.nm
INPUT "Other Notes"; channel.dis
PUT 1, record, channel
CLOSE #1
GOTO mm
viewrec:
CLS
INPUT "what record to view"; record
GET 1, record, channel
PRINT " "
PRINT "Record: "; record
PRINT "Frequency: "; channel.fq
PRINT "Name of station: "; channel.nm
PRINT "Notes: "; channel.dis
SLEEP
GOTO mm
unning a panasonic toughbook, cf-25
Posts: 42
Threads: 15
Joined: Jun 2004
hy, if you can help plz do so....
unning a panasonic toughbook, cf-25
Posts: 719
Threads: 72
Joined: Mar 2003
Code:
' DEVELOPED AND CREATED BY HAMFREAK2002
TYPE freq
fq AS LONG
nm AS STRING * 60
dis AS STRING * 80
END TYPE
DIM channel AS freq
mm:
PRINT "1) Add a record"
PRINT "2) View a record"
PRINT "3) Quit"
INPUT "What would you like to do "; mmchc%
IF mmchc% = 1 THEN GOTO addrec
IF mmchc% = 2 THEN GOTO viewrec
IF mmchc% = 3 THEN END
addrec:
OPEN "freqprog,dat" FOR RANDOM AS #1
INPUT "Record"; record
INPUT "Frequencey"; channel.fq
INPUT "Name of station"; channel.nm
INPUT "Other Notes"; channel.dis
PUT #1, record, channel
CLOSE #1
GOTO mm
viewrec:
CLS
INPUT "what record to view"; record
GET 1, record, channel
PRINT " "
PRINT "Record: "; record
PRINT " Frequency: "; channel.fq
PRINT " Name of station: "; channel.nm
PRINT " Notes: "; channel.dis
SLEEP
GOTO mm
I think that should work...
Oz~
Posts: 42
Threads: 15
Joined: Jun 2004
thx but how would i use words instead of numbers as "records" and how would i make catagpories and list them. if you know PLZ help im struggling on this one for some reason.
unning a panasonic toughbook, cf-25
Posts: 719
Threads: 72
Joined: Mar 2003
Assume that i% is the number of records...
Code:
' DEVELOPED AND CREATED BY HAMFREAK2002
TYPE freq
fq AS LONG
nm AS STRING * 60
dis AS STRING * 80
END TYPE
DIM channel AS freq
REDIM RecordStr(1 to 1) AS STRING
REDIM TempRcrdStr(1 to 1) AS STRING
DIM RecNum AS INTEGER
RecNum = 0
mm:
Record = -1 'This is just to show it hasn't been used yet...
PRINT "1) Add a record"
PRINT "2) View a record"
PRINT "3) Quit"
INPUT "What would you like to do "; mmchc%
IF mmchc% = 1 THEN GOTO addrec
IF mmchc% = 2 THEN GOTO viewrec
IF mmchc% = 3 THEN END
addrec:
'Update the Record Name Array
RecNum = RecNum + 1
GOSUB Update
OPEN "freqprog,dat" FOR RANDOM AS #1
INPUT "Record"; record
INPUT "Record Name"; RecordStr(RecNum)
INPUT "Frequencey"; channel.fq
INPUT "Name of station"; channel.nm
INPUT "Other Notes"; channel.dis
PUT #1, record, channel
CLOSE #1
GOTO mm
viewrec:
CLS
INPUT "Name/Record Number:", request$
IF LEN(request$) > 3 THEN
FOR i% = LBOUND(RecordStr) TO UBOUND(RecordStr)
IF LCASE$(RecordStr(i%)) = LCASE$(request$) THEN record = i%
NEXT i%
ELSE
record = VAL(request$)
END IF
IF record = -1 THEN
PRINT "Invalid record string or number!"
SLEEP 1
GOTO mm
END IF
GET 1, record, channel
PRINT " "
PRINT "Record: "; record
PRINT " Frequency: "; channel.fq
PRINT " Name of station: "; channel.nm
PRINT " Notes: "; channel.dis
SLEEP
GOTO mm
Update:
'Since REDIMing a cariable resets all values, we have to swap it
'around with a temporary variable
REDIM TempRcrdStr(1 to RecNum)
FOR i% = 1 TO (RecNum - 1)
TempRcrdStr(i%) = RecordStr(i%)
NEXT
REDIM RecordStr(1 to RecNum)
FOR i% = 1 TO (RecNum - 1)
RecordStr(i%) = TempRcrdStr(i%)
NEXT
RETURN
I think that should do it
:bounce:
Oz~
Posts: 42
Threads: 15
Joined: Jun 2004
thanks oz, ill put it on disk, runn it over to my laptop and start looking it over the figure out all the tips and tricks
unning a panasonic toughbook, cf-25
Posts: 2,771
Threads: 96
Joined: Oct 2003
Posts: 42
Threads: 15
Joined: Jun 2004
ya i figured that out after i posted this trheadm, dummie me took 10 minutes to find an error like that :rotfl:
unning a panasonic toughbook, cf-25