473,473 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Help in Random Accessing a file

1 New Member
hi!
i am new to VB. i wanted to store the array of data(X,Y) ,a structure using random access.and also i wanted a header for the file.

So i have store two different structures in the same file .i had opened the file with out any length being specified.i had written the header and continued writing the array of data. there is no problem. as of now i am able to read back the data(in sequence,first header fallowed by data).


will there be any problem?
is it going to work always?

please give me some insight regarding this issue.

with regards
K.S.Rao
Feb 6 '07 #1
1 920
Dököll
2,364 Recognized Expert Top Contributor
Greetings and salutations!

If you would not mind posting some of your work here, it'd be easier to help you. In the mean time, see what you can gather from the following. A computer guessing game I created from college, 1 form, 1 module, random numbers picked by your system, user/you must guess a high number and low number, pretty preliminary and simple to crack. Hope this helps you get started:

Form code, please forgive the lack of comments included today, sleepy as of now:

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim lowerbound As Integer
  3.   Dim upperbound As Integer
  4.  
  5. Private Sub connand1_click()
  6.     Form1.Label1 = Int(10 * Rnd) + 1
  7. End Sub
  8.  
  9.  
  10.  
  11.  
  12. Private Sub Command1_Click()
  13.  
  14. Module1.play_game
  15.  
  16. End Sub
  17. Private Sub form_load()
  18.     Randomize
  19.     lowerbound = Int(InputBox("enter the lower number"))
  20.     upperbound = Int(InputBox("enterput the higher number"))
  21.  
  22.     computer_num = Int((((upperbound - lowerbound + 1) * Rnd) + lowerbound))
  23.  
  24. End Sub
  25.  
  26.  
  27.  

Module code:

[code]

Public computer_num As Integer
Dim x As Integer


Public Sub play_game()

Dim use_num As Integer
x = 1
Do While x < 6

use_num = Int(InputBox("Enter your guess please!"))
If use_num = computer_num Then
Form1.Label1.Caption = "you win"

x = 7

ElseIf use_num < computer_num Then
Form1.Label1.Caption = "you are to low try again"

ElseIf use_num > computer_num Then
Form1.Label1.Caption = "your to high try again"

Else: MsgBox ("error fix me")
End If

x = x + 1
Loop

End Sub

[code]

Will post comment, if needed, late here, will check back with you in case you need further clarification.

Good luck!

Dököll
Feb 7 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Jikosan | last post by:
I can't get my "if" statement to work indicated below. What happens is no matter what the value random is, neg gets incremented by 1. This is actually my first time programming in Python. Any...
20
by: titi | last post by:
Question The road and traffic authority for a small country currently uses a system to store information about all 'currently' licensed drivers. A licensed driver has the following info stored...
2
by: Robert | last post by:
I have the XML file which has a structure similar to one I pasted at the end of this post. As you can see many elements are using different id attributes. For example element Window uses WinID...
1
by: Patrick | last post by:
Hi, This post is the 'sequel' ;) of the "Data Oriented vs Object Oriented Design" post, but it can be read and treated apart from that one. I will just quote the beginning of my previous message...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
41
by: SkyBlue | last post by:
Hi, can someone explain why the following simple C code segfaulted? I've stared it for 30mins but couldn't find the problem. Thx in advance #include <stdio.h> int main() { char *one; char...
1
by: Craig Bailey | last post by:
I recently upgraded my Mac (running OS 10.4.8) to Apache 2.0.52, MySQL 5.0.24 and PHP 4.3.9. While I seem to be accessing the latest MySQL from the Terminal, Apache seems to continue to use the...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
1
by: jobbs64 | last post by:
I'm working on a game called carpet fishing...long story...anyways I am having trouble working with the fish that I've created. I need to be able to access their Fish Class method move() so I can...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.