Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Simple Coding


hi,
can some one give me a coding to access data base in evb. i even don't know how to call the database that i've created in ms access. what is the best command to call them?
tq.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Need Help In Coding Something Simple ...
Well i just started my computing courses and after weeks of him talking complete crap we started 2 weeks ago of actual programming. The thing is he doesnt teach us how to program, he just gives us a sheet and says copy the code and create those buttons in visual basic and as by magic he expects us to understand ...

Anyways he told us now to create this ... but i havent got the slightless clue where to beggin, could you suggest some tutorials that are simmilar to this or if your really nice could do it for me :P lol.

Anyways what hes asking of me is this ..

" A theater can hold max of 500 people, create a program where one can keep track of people going in and out".

Basically i 2 command buttons 'add' and 'remove' and a text box. You press add and a box should come up you enter the number, and it should add up and give you the current value, and the same for 'remove' where u type and it would remove. When 500 pl are reached should say 'maximum copacity reached'.

Anyways thanks for any help , sorry if its in the wrong section.

Simple Coding Help
I need to open a text file and insert it LINE by LINE into a LISTBOX. If the file does not exist, I don't want anything to happen. How would I go about doing this? (Note: The file is defined using....

OPEN "c: ext.txt" FOR INPUT AS #1

Need Help With Simple Function Coding
Does anybody have some helpful hints as to how I could code something as a function? I'm trying to write some efficient, non-repetitive code to check contents of 7 identical comboboxes with identical handling. I get hung up on how to pass the 7 combobox names as a single parameter.

Here's a stripped down version of my working Subs. I'd be eternally indebted if someone could get me started in the right direction (obviously I'm weak in function writing ; but YOU will make me strong ):

' 1st sub
Private Sub cboName1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboName1.SelectedIndexChanged

If IsDBNull(cboName1.SelectedItem) Then
strName(1) = ""
Else
strName(1) = cboName1.Text
End If

Exit Sub

' 2nd sub
Private Sub cboName2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboName2.SelectedIndexChanged

If IsDBNull(cboName2.SelectedItem) Then
strName(2) = ""
Else
strName(2) = cboName2.Text
End If

Exit Sub

... on and on (7 Subs total from 1 to 7)

Thanks,
Mark

Simple Coding(solved)
hi,

i want to display all the F_upDate which is greater or equal to today's date in the MSFlexGrid. Here is my coding, its only display one record only. Can someone help to modify it.


Dim today As String
today = Format$(Date, "dd/mm/yyyy")
With rs
.Open "Select * from tblDate where F_upDate >= '" & today & "' order by F_upDate desc", con, adOpenKeyset, adLockPessimistic

While Not rs.EOF()
MSFlexGrid1.AddItem rs!EnqNo & Chr(9) & rs!F_upDate & Chr(9) & rs!FirstName ................
rs.MoveNext
Wend


thanks

Simple Coding Problem
I know I have to be overlooking something simple here so I'm asking for another set of eyes to see if they can catch my error.

the code is:

If (Format$(Time, "h:mm") > setTime) Then
aTime = True
Else
aTime = False
End If

if Time is 16:20 and setTime is 16:40, then aTime should false, right? Well aTime is always appearing to be True.

I've tried this on several different computers, so I know it just can't be my computer.

Anybody's help would be greatly appreciated.

Thanks,

Ryan

Help Coding Simple Form
I am creating a form in which when I type a value of "Canter" I can click a "Display" command button and under "RATE" and "RATE2" values which I have assigned can be displayed in their corresponding text boxes. This needs to be coded also for 3 other typed values same as Canter any help would be appreciated. I believe I need to write an If Then but I haven't been able to figure it out...help please attatched is the file

SIMPLE CODING And DECODING Program.
Hi, I am interested in laying hands on a simple coder and decoder program. The idea is that the coder will encode a given value compromsing of numbers 0-9 and letters A-Z. I would also love the encoded result to fall within this range of characters ie 0-9 and A-Z. Now it looks to easy, how can I accomplish such a task and make it a lttle tricky for a cracker to know what my code is ?

Need Major Help Coding A Simple Time Function
i need a function that will have 2 parameters:

xTime as String
Time2Add as Integer

and will add an integer to the minutes in the time parameter

ie:

Add2Time("10:33:45", 5) will return "10:38:45"
Add2Time("11:55:10",40) will return "12:35:10"

p.s.
time is 24 hours format...

any idea?

Simple Coding To Save Image Into Database Using Adodb
hi..is there a simple way to add an image file into the database using adodb? thanks.

Is That BASIC Coding Is Almost Same As VB Coding?
Let say i want to print out the record eg:PERC$ , i key in 3 difference record, but it always come the last record (the previous 2 records didn't come out).So, how i going to save PERC$ as a transaction data nor paste the PERC$ from record when print out the record? Thank you for your opinion.

Can VB Read And Write A Simple Database Into XML? Need A Simple Sample.
hi, i was thinking of storing my database info into a XML file.
i was told that XML is better than .mdb, and i dont have MySQL, plus i really wanted to try out and see if i could use XML instead.

please provide me a simple and small sample.

table1 (Login)
- Field1 (Username)
- Type (String)
- Field2 (Password)
- Type (Integer)
- Field3 (Exist)
- Type (Boolean)
- Field4 (Date)
- Type (now(dd,mm,yy))

thanks.

Simple Question Seeking A Simple Answer
How do I make the Enter Key do the same things as a Button/

Simple Simple Data Environment Question
This is my first time using the Data Environment

All I would like to do is instead of right clicking connection1 and going down to properties, and establishing a connection through there to my database.

I would like to write the code out so that I will be able to use app.path command

My purpose fo doing this is so that no matter where my project is it will never have problems finding the database.

Thanks
PinkPanther2070

Listview, Simple Problem, Simple Solution?
Place a "Listview" with 2 columns & 2 "Comboboxes" on a form. The comboboxes go below the listview representing each column of the listview.

The code I'm using to update the first column of the listview goes like this:

Me.lstVwHomeScore.ListItems.Add , , Me.cboHomeGoal.List(cboHomeGoal.ListIndex)

Now, how do I get the 2nd combobox to update the 2nd column of the same "Listview"?

I've tried everything I know and the Help files, but to no avail.

This is what I have for the second combobox, but it doesn't work.

Me.lstVwHomeScore.ListItems(RowIndex).ListSubItems.Add , , Me.cboHomeAssist1.List(Me.cboHomeAssist1.ListIndex)

Can anyone figure this out? Any help is greatly appreciated. If you need the file, let me know and I'll post it.

Thanx in advance,
Cheers

I Need Some I/O Coding Help!
Ok basicly what I need the program to do is to:
1) Open a txt file for reading
2) Read the txt file letter by letter and print each letter individually in a message box

Ex.

Text File Reads:
abc

I want the program to have one message box saying a, one saying b and the last one to say c

Can someone please help me?

Help With Coding
is there a site where i can download coding for vb so i kno what im doing

VB Coding For Tic Tac Toe
I am working on a project with a friend of mine where we are making the game "Tic Tac Toe", we have done the coding so that when someone has either 3 X's or 3 O's across or down then they get a message saying "You Win", unfortunately we are having issues with making our coding work when going diagonally. As you will see we have commented out some coding while we have tried to resolve this issue.

If someone could take a look at our code and give us some suggestions for fixing this issue it would be greatly appreciated.

Thanks


Private Sub txtgrid_Change(Index As Integer)

Dim strgrid0 As String
Dim strgrid1 As String
Dim strgrid2 As String
Dim strgrid3 As String
Dim strgrid4 As String
Dim strgrid5 As String
Dim strgrid6 As String
Dim strgrid7 As String
Dim strgrid8 As String

strgrid0 = txtgrid(0).Text
strgrid1 = txtgrid(1).Text
strgrid2 = txtgrid(2).Text
strgrid3 = txtgrid(3).Text
strgrid4 = txtgrid(4).Text
strgrid5 = txtgrid(5).Text
strgrid6 = txtgrid(6).Text
strgrid7 = txtgrid(7).Text
strgrid8 = txtgrid(8).Text

'If strgrid0 = "x" And strgrid1 = "x" And strgrid2 = "x" Then
'lblWinner.Caption = "You win"
'End If


Select Case "x"

Case strgrid0 To strgrid2
lblWinner.Caption = "You win!"
Case strgrid3 To strgrid5
lblWinner.Caption = "You win!"
Case strgrid6 To strgrid8
lblWinner.Caption = "You win!"
Case strgrid0, strgrid4, strgrid8
'lblWinner.Caption = "You win!"
'Case strgrid0 To strgrid2
'lblWinner.Caption = "You win!"
'Case strgrid0 To strgrid2
'lblWinner.Caption = "You win!"
'Case strgrid0 To strgrid2
'lblWinner.Caption = "You win!"
'Case strgrid0 To strgrid2
'lblWinner.Caption = "You win!"



'Case "o"
'lblWinner.Caption = "You win!"
End Select

End Sub

*Need Help On Coding*
Hi guys, im fairly new to vb and to this fourm but i really would like to know the code for opening a file without a dialog (ex: no browse just open the file right away) in Visualy Basic Express 2008

Thanks, badlog

Need Help With Coding
I'm trying to replace underline text with code {U} Text {/U}

The following code works great except if a document has a underline text on the and very last text of the last page.

Can anyone help me how to tell it to stop if it reaches the last page of the document?


Thanks.


Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
OUTERLOOP:
Selection.Find.Font.Underline = wdUnderlineSingle
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
If Selection.Find.Found = True Then
If Selection.Information(wdWithInTable) = False Then
Selection.Copy
Selection.Delete
Selection.TypeText "{U}"
Selection.Paste
Selection.Font.Underline = wdUnderlineNone
Selection.TypeText "{/U}"
Count = Count + 1
End If
GoTo OUTERLOOP
Else
Selection.HomeKey Unit:=wdStory
End If
MsgBox "There were" & Str(Count) & " underlined strings tagged in the document.", vbOKOnly + vbInformation, _
" Final Results"

Hey I Need Some Help With This Coding
Hey i got this rpg in the making off of planetsourcecode.com and found that that its a very good looking 3d game of the style i want in my game. I was just wondering how do you get the tree to stop moving when you move and if you can make the green box around the circle be gone and only show the tree. Also i was wondering at the same time if you could subsitute a character for the tree and make that move instead?

It should work good since i fixed all the bugs from when i downloaded it so enjoy!

Need Help With Some Coding
Just joined now. Good to be part of the crew.

I have a question about a program I have been developing. There are only a few things left to do and usually I can figure out what to do but this stumps me.
I need to save one window of my program to a file, the final window. It is called "invoice".
I think that I know how to save it to the same file everytime, but I want it variable, like in any MS program where you can choose the location to save the file to.

Some VB Coding
Hello. I need some codes in order to finish my program. I am creating a Writer. I need the following :

Undo and Redo code (with rtf and commondialog)
Print Preview, Page Setup

Only these !!!

Please help me.

Need Help With VB Coding
I have been asked to design a prototype airline program for college, the software should ask for the pre-stored passenger ID and check it is the stored list before allowing the passenger to book a seat. The software should ask the passenger to enter a seat number between 1 and 5, if the seat is already taken the program should inform the passenger and ask to pick another seat until an available seat is selected. The program is nearly working apart from the seat selection as it allows the same seat to be selected, this is my last day to get this working so any help would be greatly appreciated cheers! Here's my coding so far

'Global variables
Dim customerID(4) As String
Dim seat(4) As Integer

Private Sub cmdClick_to_start_Click()
'Created by Andrew Cassell on 8/1/07

' Name the variables
Dim flightnumber As String, inputcustid As String, wordsize As String, i As String
Dim seatOK As Boolean, numberOK As Boolean
Dim tempseat As Integer


flightnumber = "HA468"

'Customer ID's
customerID(0) = "WallaceW468P01"
customerID(1) = "LauderH468P02"
customerID(2) = "CarnegieA468P03"
customerID(3) = "ScottW468P04"
customerID(4) = "DeBruisR468P05"

For index3 = 0 To 4
'Function to get valid Customer ID
Call get_valid_ID(inputcustid)

'Function to get valid seat
Call get_valid_seat(tempseat)

'Function to display booking details
Call display_results(inputcustid, tempseat, flightnumber)
Next

End Sub

'Loop to get valid customer ID

Function get_valid_ID(ByRef inputcustid As String)

numberOK = False
Do
inputcustid = InputBox("Please enter your customer ID")

For Index = 0 To 4
If inputcustid = customerID(Index) Then numberOK = True
Next
Loop Until numberOK = True

End Function

'loop to get seat number and check seat is available

Function get_valid_seat(ByRef tempseat As Integer)

seatOK = False

tempseat = InputBox("Please enter a seat number between 1 and 5")

For Index2 = 0 To 4
seat(Index2) = tempseat
Do
'Makes sure the number entered is between 1 and 5
If tempseat > 5 Or tempseat < 1 Then tempseat = InputBox("Please enter a seat number between 1 and 5")
Loop Until tempseat < 6 And tempseat > 0

For i = 0 To 4

If i < Index2 Or i > Index2 Then seatOK = True
If seat(i) = seat(Index2) Then seatOK = True
Next
Next

If seatOK = False Then seat(i) = InputBox("That seat was taken please pick another")
If seatOK = True Then MsgBox ("Seat number accepted")

End Function

'Function to display results

Function display_results(ByRef inputcustid As String, tempseat As Integer, ByVal flightnumber)

lstResults.AddItem ("Flight Number = " & flightnumber)

wordsize = Len(inputcustid)
wordsize = wordsize - 6
custname = Mid(inputcustid, 1, wordsize)
lstResults.AddItem ("ID = " & inputcustid)
lstResults.AddItem (custname)
lstResults.AddItem ("Seat Number = " & tempseat)
lstResults.AddItem (" ")
End Function

Need Help With Coding
I have been asked to design a prototype airline program for college, the software should ask for the pre-stored passenger ID and check it is the stored list before allowing the passenger to book a seat. The software should ask the passenger to enter a seat number between 1 and 5, if the seat is already taken the program should inform the passenger and ask to pick another seat until an available seat is selected. The program is nearly working apart from the seat selection as it allows the same seat to be selected, here's the code any suggestions would be much appreciated cheers.


Code:
'Global variables
Dim customerID(4) As String
Dim seat(4) As Integer

Private Sub cmdClick_to_start_Click()

' Name the variables
Dim FlightNumber As String, inputcustid As String, wordsize As String, i As String
Dim seatOK As Boolean, numberOK As Boolean
Dim tempseat As Integer


FlightNumber = HA468

'Customer ID's
customerID(0) = "WallaceW468P01"
customerID(1) = "LauderH468P02"
customerID(2) = "CarnegieA468P03"
customerID(3) = "ScottW468P04"
customerID(4) = "DeBruisR468P05"

For index3 = 0 To 4
'Function to get valid Customer ID
Call get_valid_ID(inputcustid)

'Function to get valid seat
Call get_valid_seat(tempseat)

'Function to display booking details
Call display_results(inputcustid)
Next

End Sub

'Loop to get valid customer ID

Function get_valid_ID(ByRef inputcustid As String)

numberOK = False
Do
inputcustid = InputBox("Please enter your customer ID")

For Index = 0 To 4
If inputcustid = customerID(Index) Then numberOK = True
Next
Loop Until numberOK = True

End Function

'loop to get seat number and check seat is available

Function get_valid_seat(ByVal tempseat As Integer)

seatOK = False

tempseat = InputBox("Please enter a seat number between 1 and 5")

For Index2 = 0 To 4
seat(Index2) = tempseat
Do

If tempseat > 5 Or tempseat < 1 Then tempseat = InputBox("Please enter a seat number between 1 and 5")
Loop Until tempseat < 6 And tempseat > 0

For i = 0 To 4
If i <> Index Then seatOK = True
If seat(i) = seat(Index2) Then seatOK = True
Next
Next

If seatOK = False Then seat(i) = InputBox("That seat was taken please pick another")
If seatOK = True Then MsgBox ("Seat number accepted")

End Function

'Function to display results

Function display_results(ByVal inputcustid As String)

lstResults.AddItem ("Flight Number = HA468 ")

wordsize = Len(inputcustid)
wordsize = wordsize - 6
custname = Mid(inputcustid, 1, wordsize)
lstResults.AddItem ("ID = " & inputcustid)
lstResults.AddItem (custname)
lstResults.AddItem ("Seat Number = " & seat(Index))
lstResults.AddItem (" ")
End Function

A Better Way For Coding?
I have two combobox and a textbox. I am using these controls for filtering
My columns in a grid. I am using multiple if statements to do the filtering

i.e
If cb1.text <>"" and cb2.text="" and txtMsg.text="" then
' do the filtering
If cb1.text <>"" and cb2.text<>"" and txtMsg.text<>"" then
do the filtering

and ...

Is there a better way to do this?

Help In Coding
hi frds
i m trying to read a text file which is like as in attchment
so,i hava 6 different tables so i want to store data into them using text file
this text file has differnt delimiter.thanks in advance. plz do reply

Help With MDI Coding
This is my first time doing a MDI form and I need help in spotting the complie error for me. As the prompt of error is "Method or data member not found". What does that mean?

Anyway here is part of my coding.

Private Sub CarDetaila_Click()


Unload CarDetailb
Unload CarDetailc
Unload SearchCustID
Unload SearchCar
Unload SearchInvoice
Unload Customer
Unload rent
Unload returned


Load CarDetaila
CarDetaila.Show
End Sub

Thanks.

Coding Help
Hello I have a question:

1: I have designed a student database input screen that
garthers information and then displays a profile built up
from the imputs, I have done most of the coding, can get
the program to end and clear the boxes for a new profile,
however cant seem to get my message box to display a
full message .... can anyone help me? I have included a
copy of my code which is as follows:

Dim StudentAge, StudentYear, StudentSex As String
Private Sub Cmd1_Click()
Dim Msg As String
Dim I As Integer
Dim Pronoun As String
Dim str As String
Rem current year
current_year = 2004
Rem Check to make sure name entered
If TxtName.Text = "" Then
MsgBox "The profile requires a name."
End If
Rem create student profile, name, grade, age
Rem (subtract year born from current year)
Msg = TxtName.Text + " is a student in " + StudentYear + vbCr
If StudentSex = True Then
Pronoun(StudentSex) = "He is"
Else
Pronoun(StudentSex) = "She is"
End If
Msg = Msg + str$(current_year - ComboYear) + "years old"

MsgBox Msg, vbOKOnly, "Student Profile"

End Sub
Private Sub Cmd2_Click()
Rem Blank out name and reset check boxes
Dim I As Integer
TxtName.Text = ""
For I = 0 To 5
Optyear(I).Value = vbUnchecked
Next I
ComboDay(0).Clear
ComboMonth.Clear
ComboYear.Clear
End Sub
Private Sub Cmd3_Click()
End
End Sub

Private Sub Form_Load()
StudentSex = "Male"
StudentYear = "Year 7"
With ComboDay(0)
.AddItem "01"
.AddItem "02"
.AddItem "03"
.AddItem "04"
.AddItem "05"
.AddItem "06"
.AddItem "07"
.AddItem "08"
.AddItem "09"
.AddItem "10"
.AddItem "11"
.AddItem "12"
.AddItem "13"
.AddItem "14"
.AddItem "15"
.AddItem "16"
.AddItem "17"
.AddItem "18"
.AddItem "19"
.AddItem "20"
.AddItem "21"
.AddItem "22"
.AddItem "23"
.AddItem "24"
.AddItem "25"
.AddItem "26"
.AddItem "27"
.AddItem "28"
.AddItem "29"
.AddItem "30"
.AddItem "31"
End With
With ComboMonth
.AddItem "01"
.AddItem "02"
.AddItem "03"
.AddItem "04"
.AddItem "05"
.AddItem "06"
.AddItem "07"
.AddItem "08"
.AddItem "09"
.AddItem "10"
.AddItem "11"
.AddItem "12"
End With
With ComboYear
.AddItem "1986"
.AddItem "1987"
.AddItem "1988"
.AddItem "1989"
.AddItem "1990"
.AddItem "1991"
.AddItem "1992"
.AddItem "1993"
.AddItem "1994"
End With
End Sub
Private Sub OptSex_Click(Index As Integer)
StudentSex = OptSex(Index).Caption
End Sub
Private Sub Optyear_Click(Index As Integer)
StudentYear = Optyear(Index).Caption
End Sub

Any help would be appreciated

Graham.

I Need Help With Coding
I'm trying to make a program that can count how many characters are in a cell. I'm fairly new at Visual Basic, so, it'd be great if someone could give me a few pointers on how to do this. Thanks in advanced :-)

-Evin290

Coding
how would I code this:
compare the value in a cell (say e2) to the values in a column of values (say - greater than or equal to the value in p1 but less than or equal to q1 (this can also be looked as a between p1 and q1), if not a match, greater than or equal to the value in p2 but less than or equal to q2, if not a match, greater than or equal to the value in p3 but less than or equal to q3, if not a match, greater than or equal p39 and less than or equal to q39 (end of list)) until there is a match and mark column r at which ever corresponding row number (1 thru 39) with the value in cell n2, then move down to cell e3 and run the complete scenario again, greater than or equal to p1 but less than of equal to q1, thru p39 and q39 and mark the corresponding r 1-39 with the value in n3 and move to e4, greater than equal to p1 but less than or equal q1, thru p39 and q39 and mark the corresponding r 1-39 with the value in n4, etc to the list of column "e" values.

Can this be done and can you help me code it? Much appreciated

Help On Coding
hello every one... I m a new girl that starting using on vb.
i got a probrem to write a coding on Add,Edit,Delete and Find function.
so anyone have any sample that can let me have a look or can anyone teach me how to write . I'm using an ADODB as a database connection.

TQ
and please is urgent need it......

V.B Coding
I am currently doing a visual basic course and i need to know how to code the following.
I have to put six lottery balls on a form with color and a number on each one.
I have tried several codes but nothing works, can anybody help me.

Coding Help
Hi,

Can someone help me code this please with Visual Basic 6?

If I enter c:myfile.txt then the program will display “The device is c”

If I enter file://ntoito1.prd02.ansii.txt the program will display “The device is File”

All I need is to return what is left of the colon.

If no Colon is entered, I need to display an error message stating that no colon was entered

Thanks.

Help With Coding
I'm rather new to VB...I learned the language during the winter at school...and didn't use it a lot. Now that I don't have the book, I have to work on a real application..
First of all, anyone know of any good online references other than coming here and begging for help?
My application is to view current times in all the time zones.. a current screenshot is at http://weirdkarma.netfirms.com/Clipboard.jpg
Underneath each clock is a button you can click to change the reference city..I'm having a little bit of trouble coding this all though..
I know how to get the system time..and even GMT..but how can I change this to get all time zones? Is there a way I can "add" hours?
Second of all.. when you click the button to change the reference city, I have another form pop up where you can do that..and clicking okay resets the caption. How can I do this for 24 buttons without 24 extra forms? (I think there is something to do with an input box, but i don't know how to use it..)
Any help would be appreciated
Steph

Coding Help
hi. i am needing some help with my coding. i am trying to make it so that the file name of a .bmp that loads in my program comes up in a listbox. i need to have the shortened version of it instead of the full path name. i cant seem to make it work. here is what i have so far.


Code:
Private Sub cmdImage_Click()
Dim strfilename As String
Dim intposition As Integer

On Error GoTo errhandle
CD.CancelError = True
CD.Filter = "Bitmap(*.bmp)|*.bmp|Ico(*.ico)|*.ico"
CD.ShowOpen
pathStr = CD.FileName
If CD.FileName = "" Then
Exit Sub
End If
lstFileName.AddItem (pathStr)
With imgLoadImage

.Picture = LoadPicture(pathStr)

intposition = InStrRev(CD.FileName, "")
strfilename = Right(CD.FileName, Len(CD.FileName) - intposition)

lstFileName.AddItem strfilename

Coding Help
hey everyone,

I'm having some coding issues (surprise surprise) with a project I am working on. I have created a button that allows for people to change the backcolor when clicked, my issue is that when they click cancel or don't choose a color they are supposed to get a popup stating that no choice was made. Can you take a look at my coding and tell me what is wrong? For some reason VB doesn't like the CD.Showcolor line near the top of this coding.

Thanks for the help.


Option Explicit
Dim pathStr As String
Private Sub cmdColor_click()
CD.CancelError = True
CD.ShowColor
Me.BackColor = CD.Color

Exit Sub
errhandle:
MsgBox "You did not select a color!"

End Sub

Private Sub cmdImage_Click()
On Error GoTo errhandle

CD.Filter = "Bitmap(*.bmp)|*.bmp|Ico(*.ico)|*.ico"
CD.ShowOpen
pathStr = CD.FileName
If CD.FileName = "" Then
Exit Sub
End If
lstFileName.AddItem (pathStr)
With imgLoadImage

.Picture = LoadPicture(pathStr)
Exit Sub

errhandle:
Select Case Err.Number
Case 35752
MsgBox "sorry,can't open this type of file."
Case 35700

Case Else
MsgBox "No Idea"

MsgBox Err.Number
End Select
End With
End Sub

Coding Help
Code:
mySQL = "SELECT vsBranchNo,vsLevel, vsName, vsPlace, vsEmail FROM tblUserLevel WHERE vsLoginName = '" &lv_username & "' "
Hi, Look at the above code. I have a assignment string in VB. I prefer to display the assignment statement in more than one line such that it could be readable. I know by putting some character at the end we can form the string. But I could not remember. I expect the statement should be like below.

Code:
mySQL = "SELECT vsBranchNo,
vsLevel,
vsName,
vsPlace,
vsEmail
FROM tblUserLevel
WHERE vsLoginName = '"
So it could be readable. Any suggessions

Help With OLE Coding
Hi i'm making a program for school, and I need it so music plays in the background.
I figured out how to make an OLE midi sequence and have made 3 option buttons.
the first option is to play the first song, second to play the second song, and third to stop all music.

the code i have is:

Private Sub Option1_click()
OLE1.DoVerb
End Sub

Private Sub Option2_Click()
OLE2.DoVerb
End Sub

The music plays when i click on the option buttons, but as soon as i click on another button or anything else in the program, the music stops. Can sum1 help me so that the music doesn't stop when i click on something.
Thanks~

Help With Coding
Howdy,
I am looking for a general solution, not exactly code. I have 5 variables, X,Y,I,J,F. The input is any combination of these 5. For example some lines would look like this

Code:
G01X11.436Y7.783
G01X4.774Y35.665F10.197
G01X4.751Y35.761F9.535
G01X4.728Y35.857F6.356
G01X4.63
What I have to do is some math on these variables and then print the new values to a file in the same format. My problem is that I do not want to make exceptions for every possible combination. If the input does not have a Y value, then Y is omitted. I am trying to get away from something like this


Code:
If X <> -999 And Y <> -999 And I <> -999 And J <> -999 And F <> -999 Then
Print #1, "G01X" & udtGarray(lngB).x - Xoffset & "Y" & udtGarray(lngB).y - Yoffset & "I" & udtGarray(lngB).i - Xoffset & "J" & udtGarray(lngB).j - Yoffset & "F" & udtGarray(lngB).f + (lngFeedratePercent * udtGarray(lngB).f)
ElseIf X <> -999 And Y <> -999 And I <> -999 And J <> -999 And F = -999 Then
Print #1, "G01X" & udtGarray(lngB).x - Xoffset & "Y" & udtGarray(lngB).y - Yoffset & "I" & udtGarray(lngB).i - Xoffset & "J" & udtGarray(lngB).j - Yoffset
elseif ...
I hope that this is possible, and thanks for any help you can give.
Stuart

Need Help With Some Coding
i need some help with converting hex to ascii.

Encoded = Encoded & Hex(asc(Mid(txt, i, 1)))

I have code similar to the example above... and I just wanted to know if it is possible to do something similar in converting to ascii.

Need Help With Some Coding
Alright, i dont know to much bout VB i did some in school but not much. I need to know how to do a certain thing using vb, like a coding.

What i want is to be able to have the program made in VB open, be able to hit a hotkey thats in the coding then right click on a spot then be able to left click all i want and it will still right click automatically in between every left click. The hotkey part turns on the auto right clicking and turns it off when you hit it.

Is there anyone out there that knows coding to do this our could figure it out easily? if not then heres a challange, make the coding for it for me! Lol please, if you know, or think you could figure it out, do so. Thanks.

Coding?? Plz
Before I start I wanna say... I'm a total newbie in this program!

I'm building a kind of translater. So I have 2 text boxes and a buttom!

The buttom script looks like this:

Private Sub Command1_Click()
Text2 = Text1

End Sub


... BUT... its a translater so I looking for the script that can replace words... like

Private Sub Command1_Click()
Text2 = Text1
replace "ich" = "I"
End Sub.... just and examble...

plz help me! Thanks

PS2 Coding
This might be a bit too adventurous for the intermediate user but suggestions please.

I am trying to figure out what language do Playstations 2 use. The reason beeing, ebcuase i am wanting to make a PC program where it reads the BIN/CUE image file from a particular game (PRo Evolution Soccer 2) and display certain infomation on the screen IE. Player Names, Number etc... And then let the user modify these and then apply them the image file and then be able to run the game with all the updated info.

To me this sounds like a way to advanced project, but hopefully it isn't.



Could anybody give me any kind off help to this problem?????

Pls Help Me With This Coding
i have problem with this coding, help me to fix this coding..tq

Code:
Private Sub Form_Load()
Dim refNumber As String
Dim refNum As Integer
Dim NowYear As Date
Dim referNum As String
Set Conn = GetConnection
Set Rs = New ADODB.Recordset
'Rs.Open "SELECT bahan_mentah.norujukan, pekerja.norujukan, pembekal.norujukan " & _
' "FROM pekerja, bahan_mentah " & _
' "INNER JOIN pembekal ON bahan_mentah.kodBM = pembekal.kodBM " & _
' "where norujukan = '" & txtNoRujukan.Text & "'"
Rs.Open "SELECT bahan_mentah.norujukan, pekerja.norujukan, pembekal.norujukan " & _
"FROM pekerja, bahan_mentah " & _
"INNER JOIN pembekal ON bahan_mentah.kodBM = pembekal.kodBM ", _
Conn, adOpenStatic, adLockOptimistic


If Rs.EOF Then
refNum = 1
Else

refNum = Rs("norujukan") + 1
End If

If refNum < 10 Then
refNumber = "00" & refNum
Else
If refNum < 100 Then
refNumber = "0" & refNum
Else
refNumber = refNum
End If
End If

'referNum = "REP"&refNumber&"/"&NowYear& ""

referNum = "REP" & refNumber & NowYear
txtNoRujukan.Text = referNum
Rs.Close
Set Rs = Nothing
'center the form
Me.Move (Screen.Width / 2) - (Me.Width / 2), (Screen.Height / 2) - (Me.Width / 2)

End Sub

Help With My Coding
Hi I've read the drag and drop tutorial and I managed to code. I'm having this problem.

When I drag the Picture1 drags to textbox1 but it hides behind the textbox. Picture2,3,4,5, dont drag at all.

Second probelm is that i'm only getting the mark for Picture1 only. Well I reckone one problem is linked to the other. Can some please, please have a look at my coding and tell where I've done wrong.

Also i'm trying to linke to an existing Word document but some coding is missing....

Thanks loads..

Option Explicit
Dim match1 As Boolean
Dim match2 As Boolean
Dim match3 As Boolean
Dim match4 As Boolean
Dim match5 As Boolean
Dim numpoints As Integer

'Dim wdoc As Word.Application

Private Sub Text1_DragDrop(Source As Control, X As Single, y As Single)
match1 = False
If TypeOf Source Is PictureBox Then
If Source.Tag = "Match1" Then
match1 = True
Picture1.Left = Text1.Left 'check controls
Picture1.Top = Text1.Top
End If

End Sub


Private Sub Text2_DragDrop(Source As Control, X As Single, y As Single)
match2 = False
If TypeOf Source Is PictureBox Then
If Source.Tag = "Match2" Then
match2 = True
Picture2.Left = Text2.Left 'check controls
Picture2.Top = Text2.Top
End If

End Sub

Private Sub Text3_DragDrop(Source As Control, X As Single, y As Single)
match3 = False
If TypeOf Source Is PictureBox Then
If Source.Tag = "Match3" Then
match3 = True
Picture3.Left = Text3.Left 'check controls
Picture3.Top = Text3.Top
End If

End Sub

Private Sub Text4_DragDrop(Source As Control, X As Single, y As Single)
match4 = False
If TypeOf Source Is PictureBox Then
If Source.Tag = "Match4" Then
match4 = True
Picture4.Left = Text4.Left 'check controls
Picture4.Top = Text4.Top
End If


End Sub
Private Sub Text5_DragDrop(Source As Control, X As Single, y As Single)
match5 = False
If TypeOf Source Is PictureBox Then
If Source.Tag = "Match5" Then
match5 = True
Picture5.Left = Text5.Left 'check controls
Picture5.Top = Text5.Top
End If
End Sub

Private Function points() As Integer
Dim numpoints As Integer
numpoints = 0
If match1 = True Then numpoints = numpoints + 1
If match2 = True Then numpoints = numpoints + 1
If match3 = True Then numpoints = numpoints + 1
If match4 = True Then numpoints = numpoints + 1
If match5 = True Then numpoints = numpoints + 1

points = numpoints

End Function

Private Sub CmdSubmit_Click()
MsgBox points()
Unload Me

'Set wdoc = CreateObject("Word.Application")
'wdoc.Documents.Open ("C:windowsdesktopclass.doc")
'wdoc.Visible = True
'wdoc.WindowState = wdWindowStateNormal

Form5.Show

End Sub

Need Help In VB Coding
I cant get this to work, i really need help. i want to a fomula n x 35 = labor then n x 5% = cost and labor + cost = total. i really need help. Im a beginner in this, so if you have the time, can you help me. thnx!

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim rate, sale, labor, total, cost As Double
With lstResults.Items
rate = 35
sale = 0.05
total = labor + cost
.Clear()
.Add(labor = CDbl(TextBox2.Text * rate))
.Add(cost = CDbl(TextBox3.Text * sale))
.Add(total = CDbl(labor + cost))
End With

End Sub

Better Coding
I have these two procedures for every text box that I have on my form, where they simply change the back colour of the text box when it receives the focus.
With 15 to 20 txtboxes this seems to be a waste of coding.


Code:
Private Sub txtBrand_LostFocus()
txtBrand.BackColor = &HFFFFFF
txtBrand.Text = UCase(txtBrand.Text)
End Sub

Private Sub txtBrand_GotFocus()
txtBrand.BackColor = &HFFC0C0
End Sub

Is there a better way to do one function which will do the same thing for all textboxes, I know I can reference all textboxes with...
Dim MyTxtBox as TextBox

but how can I do

Private Sub EveryTextBoxOnForm_Lostfocus()



Cheers
Thanks for any help.

Asking Some SQL Coding
Let's say i have 2 tables that have no relation.

Table 1 consist of:
apple
watermelon

Table 2 consist of
Cat
Dog

How do i add record into two table ? (ADO)

Gap Coding
I am trying to find coding for gap. I need to put in my accounting audit system software. Can someone help me?

In my accounting audit system software, I need to audit the accounting records that stored in Microsoft Access. For example, if the 'ID' number is from 1 to 300, how I'm going to find the gap of the number in between this range of number. Let say, number 57 - 105 missing in the records,then how can I let it appear in listview control in my VB 6.0? Besides, I also want to know how can the total number of missing records (gap) can show in listview control?

checkConnection
strSQL = "select l.Id + 1 as start from qSalesOrder as l left outer join qSalesOrder as r on l.Id + 1 = r.Id where r.Id is null;"
rec1.Open strSQL, Con, adOpenStatic

listData.ListItems.Clear
listData.ColumnHeaders.Clear

With listData.ColumnHeaders
.Add , , "From ID", 2000, lvwColumnLeft
.Add , , "To ID", 2000, lvwColumnLeft
.Add , , "Number of Gap", 2000, lvwColumnLeft
End With

While Not rec1.EOF
Set lst = listData.ListItems.Add(, , rec1(0), ,1)
rec1.MoveNext
Wend
rec1.Close
checkConnection

i already use this code. but the record only show as below:
From ID : |To ID: |Number of Gap|
57
266

the "To ID:" and "Number of Gap" cannot show anything
so what code should i use to view them?

Copyright © 2005-08 www.BigResource.com, All rights reserved