473,505 Members | 13,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

URGENT : Picking a Picture

Ali Rizwan
925 Contributor
Hello all,
I have a main folder name IMAGES and have sub folders of that name A,B,C,.....,Z.
And the sub folders contain images with name like in Folder A : Apple, Anchor etc and in B : Ball, Bear, Bat

I have 4 Image controls.

Now i want that when ever i write a letter in a text box it automatically put a random picture from sub folder. Like if i write G then it goes to folder G and then fetch a random picture and load that in one of the image control.That one image control in which the picture has to be loaded also selected randomly. And in other 3 image controls from random folders random pictures will be loaded. I m also trying this but always my code is getting long and typical so i want a short way to solve this problem.

Give me Logics, Code or any idea to do this task.

Thanx
>> ALI <<
Feb 9 '08 #1
2 1086
daniel aristidou
491 Contributor
Hi ali
What version of vb are you using
my advice is to use a random integer function that returns a rounded value
Between 1 and the count of files in the folder...
Feb 9 '08 #2
Ali Rizwan
925 Contributor
I m using VB6.

I have used this code to generate Alphabet ASCII code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub GNO()
  2.  
  3. '===============================
  4.  
  5.         Randomize
  6.             lblP(0).Caption = Int((25 - 1 + 1) * Rnd + 1) + 64
  7.  
  8.  
  9. '===============================
  10.  
  11.         Randomize
  12.             lblP(1).Caption = Int((25 - 1 + 1) * Rnd + 1) + 64
  13.  
  14.         If lblP(1).Caption = lblP(0).Caption Then
  15.  
  16.             Do While Not lblP(1).Caption = lblP(0).Caption
  17.                 Randomize
  18.                     lblP(1).Caption = Int((25 - 1 + 1) * Rnd + 1) + 64
  19.             Loop
  20.  
  21.         End If
  22.  
  23. '===============================
  24.  
  25.         Randomize
  26.             lblP(2).Caption = Int((25 - 1 + 1) * Rnd + 1) + 64
  27.  
  28.         If lblP(2).Caption = lblP(0).Caption Then
  29.  
  30.             Do While Not lblP(2).Caption = lblP(0).Caption
  31.                 Randomize
  32.                     lblP(2).Caption = Int((25 - 1 + 1) * Rnd + 1) + 64
  33.             Loop
  34.  
  35.         End If
  36.  
  37.         If lblP(2).Caption = lblP(1).Caption Then
  38.  
  39.             Do While Not lblP(2).Caption = lblP(1).Caption
  40.                 Randomize
  41.                     lblP(2).Caption = Int((25 - 1 + 1) * Rnd + 1) + 64
  42.             Loop
  43.  
  44.         End If
  45.  
  46.  
  47.  
  48. '==============================
  49.  
  50.         Randomize
  51.             lblP(3).Caption = Int((25 - 1 + 1) * Rnd + 1) + 64
  52.  
  53.         If lblP(3).Caption = lblP(0).Caption Then
  54.  
  55.             Do While Not lblP(3).Caption = lblP(0).Caption
  56.                 Randomize
  57.                     lblP(3).Caption = Int((25 - 1 + 1) * Rnd + 1) + 64
  58.             Loop
  59.  
  60.         End If
  61.  
  62.         If lblP(3).Caption = lblP(1).Caption Then
  63.  
  64.             Do While Not lblP(3).Caption = lblP(1).Caption
  65.                 Randomize
  66.                     lblP(3).Caption = Int((25 - 1 + 1) * Rnd + 1) + 64
  67.             Loop
  68.  
  69.         End If
  70.  
  71.         If lblP(3).Caption = lblP(2).Caption Then
  72.  
  73.             Do While Not lblP(3).Caption = lblP(2).Caption
  74.                 Randomize
  75.                     lblP(3).Caption = Int((25 - 1 + 1) * Rnd + 1) + 64
  76.             Loop
  77.  
  78.         End If
  79.  
  80.  
  81. End Sub
But the problem is that the alphabets are some time are same in boxes.
I want that every time in every box of four boxes or labels there is a different alphabet and is selected randomly.

And one thing more how can i convert that ASCII code to alphabets??

Thanx
>> ALI <<
Feb 9 '08 #3

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

Similar topics

4
2760
by: Sachin Jagtap | last post by:
Hi, I am getting exception while poping item from queue, I am writing messages coming from client in a queue in one thread and then in other thread i am reading from queue and writing in file....
3
2401
by: Rob | last post by:
I have a form - when you click the submit button, it appends a variable to the URL (e.g. xyz.cgi?inputID=some_dynamic_variable) It also opens a new page. Now, that some_dynamic_variable is...
1
2045
by: AvrilComplic8ed | last post by:
Hello there I wonder if you can help me. I am creating a loans system for a make-believe CD rental company, in Microsoft Access. I have 3 tables: CD details, Member Details, and Loan Details. I...
0
1088
by: adi sesha | last post by:
Hi i am able to rotate the picture in the picture box to the specific angle in vb.net but i want to rotate the picture CONTROL to the specified angle.Thanks in advance sesha ...
5
2484
by: SeanT | last post by:
Greetings and salutations! I am having a real issue with the VB.NET TreeView control. I need to display an image (a.k.a. logo, picture, etc) from a file as the treenode object. I can not seem to...
1
1515
by: kumar_ps | last post by:
in my scanning application i am using a picture box .When we scan a page it will comes to picturebox. here i am taking a dialogbuton for save the image. i want to save the image in pdf or tif or jpeg...
1
2580
by: candice | last post by:
Hallo, I'm beginner and need help to do my project. I want to ask that how to save picture or image into database and can display back again form load when need call the picture from the database. ...
3
1684
by: dAttitude | last post by:
hi guys .. my team is working on an application where we have to have one image which is acting as the base of all the elements on the screen ... and this same image has a transparency in the center....
0
1485
by: desturrr | last post by:
I am using netbeans ide gui designer , i have placed a panel which has a picture in it , and i want to place another tiny pictures on this main picture, What can i do to manage this , Can i make the...
0
7213
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,...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5610
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,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4698
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
3187
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
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1526
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 ...
1
754
muto222
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.