Please Help.. My Program I Worked So Hard On Wont Open In School..
I worked forever on a simple program at home - just one form. i saved all the files (vbp,vbw and frm file) and sent it to me thru email so i can open it at school. well, i downloaded all the files, put them in the same directory but it wouldnt open
then i tried to just open the form (because thats all the program is - one form) and when it was isnerted into the program, it got inserted as a module for some reason and not a form.. its icon was a form one, and other forms for other programs were opening fine, but this one wasnt. it kept adding itself as a module
when i looked at the source, i saw it had something like "VERSION 5#" while the forms i made at school were "VERSION 5.00". so, i thought i could simply replace # iwth .00, but that didnt work.. ALL sorts of errors occured.
does anyone know why this is happening and how i can open it at school?
I think it can be because im using SP5 at home and i think im using the original in school.. is there any way i can open my form at school? need to ahnd it in =(
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Code Worked At School Now It Doesnt
Hey I have this code below that I wrote at school and Im trying to transfer it to work on my home system but it wont work. I think it might have something to do with the refferences that I have in the porject. Does anyone know what references I need to install to make this work?
Private Sub Form_Load()
Dim x As Integer
Dim y As String
Dim MyConn As ADODB.Connection
Dim MyRecSet As ADODB.Recordset
Set MyConn = New ADODB.Connection
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:WINNTProfileslab-208snDesktopTISCustomers.mdb;"
MyConn.Open
x = Form2.Text1.Text
y = Form2.Text2.Text
Set MyRecSet = MyConn.Execute("SELECT Balance FROM Customers where Pin = " & x & " and Account = '" & y & "'")
Do Until MyRecSet.EOF
strBalance = MyRecSet("Balance")
lstData.AddItem strBalance
'Puts the data into a list file
Text1.Text = strBalance
'puts the data into textbox
MyRecSet.MoveNext
Loop
MyConn.Close
End Sub
HELP PLEASE! Program Fails To Open File But It Worked Earlier
Alright this program (the one ive been asking for help with the past two days) was working just like i wanted it to. now all of the sudden, without any major changes in the program, it stops working. i get an error when trying to open a text file. it says its already open. but im 100% sure its not. i need to hand this in first thing tommorow and i dont know what to do. ive attached it below for you to look at. and all help is appreciated.
after a bit of further investigation into the problem, it only occurs when the save button is clicke AFTER the retrieve button has been clicked. still need help though.
thankyou very much,
GW2
School Assignment - Open IE {resovled}
Hello,
Im quite a beginner and i was wondering if there was ANY code for VB6 that would allow me to open an Internet Explorer Window when my user presses the Help Button.
ANY help would be excellent
Darcey
Program For School...Much Help Needed.
I am in dire need of help with this programming assignment. I am completely nnew to ActiveX controls and don't even know how to begin to get started other than adding the command buttons to the form and getting the activeX control put on the form. I don't know how and what to code to make it work.
In this exercise, you will create a ActiveX control built from two consituent list boxes and five command Buttons. In your completed code, when the user clicks the Select command button, the currently selected item in the first list box should move to the second lsit box. When the Deselect commdan button is clicked, the selected item in the second list box shold move to the first list box. The Deselect all command button should move all items from the second list box to the first list box. The Clear All button removes all items from both lists. Such a control would be useful for selecting fields in a database or names from a list, for example.
So I have:
2 list boxes.
5 command buttons ( Select, Deselect, Select All, Deselect All, Clear all)
And finally have no clue as to what to do. I am not looking to get someone to do the program for me. I want to learn how to do it, however the book is of no help and the class is internet based with no help from any reliable instructor so I figured this is the best way to find some good help on how to get started and to be lead in the right direction.
Please, any help would be greatly appreciated.
Jeremy Jones
Should I Have 100s Of Winsock Connections Open/close.. Or Keep Them Open (hard Q)?
Hello
Ive got a server to which many clients connect to.
They each are given a few tasks to complete - which may or may not take a long time to finish, and after each task is done they send back the result.
This has caused massive amounts of problems for me. Right now I keep the connections open all the time. My server listens on one particular winsock control on a particular port to which all clients connect. It then accepts the connection request thru a second array of winsocks, so each client is connected to the server via the array via one connection.
There is generally no problem sending out the tasks thru that single connection/client - but receiving is a problem. The client may need to send back a few hundred kb at a time but since it was completing several tasks at once - it is not always received correctly. My guess is because taskA is sending data thru the connection at the same time as taskB - and the data isnt received right (each task sends its data via a <start> and an <end> string so I know where the start/end of data is and when transmission is over). Its important to note that the tasks are multithreaded (via a 3rd party control)
The data is sent in one line per task. winsock.SendData theResult. But many tasks can complete at around the same time. I thought that VB would wait until the data was completely sent (for one lines code) before moving on... but I dont think this is happening. I even tried adding a DoEvents but to no avail - I still cant receive the data properly. Maybe winsock is 'skipping over' some data - I dont know. (Kinda like when if you 'break' the application winsock does not get incoming data and when you resume it still wont pick it up)
So Ive got 2 options..
1) Somehow figure out how to receive data properly when multiple tasks finish on a client at around the same time and they send data at the same time - basically making the program send the data of a task and not continue until the data has been sent, then send another tasks data.
2) Use many connections. Basically the max # of tasks running at once will be about 10. So the idea is to have another winsock array of 10, each dedicated to one task, and when a task is completed - connect thru the winsock array, send the data, and when the server receives it - it disconnects.
3) A mixture of 1 and 2 - have the 10 winsocks connect to the server and be open at the same time, then I can just send data and receive via a specific winsock array control and there is no problem distinguishing taskA from taskB from taskC on a client, or client from client.
But honestly.. I dont know if its 'bad' to have lots of connections open and close all the time. And I dont know if its 'bad' to have thousands of connections open at the same time either..
What do you guys think?
Open File On Hard Drive
Hi,
I'm new to VB, i want to know if this can be done. From the net using Visual Basic, can i open a file on the C Drive and insert predefined data into it or modify existing data?
Thanks.
Really Hard Question {open Word Document From VB}
Hello, i was wondering if anyone had some good sorce code, or new a few good functions that could open a saved word document from within a visual basic program... ie --> the user clicks a button, and help.doc opens... ive had some ideas with shell and create commands, but im stumped...
Really Hard Program
Mr. Smith's Wire Company sells spools of copper wiring for $100 each. The normal delivery charge is $10 per spool. Rush delivery costs $15 per spool. Create an application that displays the status of an order. The status should include the following:
•The number of spools ready to ship
•The number of spools on back order
•The shipping and handling charges
•The total amount due
The user should enter the number of spools ordered into the text box, and check the Rush Delivery check box if rush delivery is desired. When the Calculate Total button is clicked, an input box should appear asking the user to enter the number of spools currently in stock. If the user has ordered more spools than are in stock, a portion of the order is back-ordered. For example, if the user orders 200 spools and there are only 150 spools in stock, then 150 spools are ready to ship and 50 spools are back-ordered.
The application should have the following functions, called from the Calculate Total button’s Click event procedure:
GetInStock : Display an input box asking the user to enter the number of spools stock. The function should return the value entered by the user.
ReadyToShip :Accepts the following arguments: the number of spools in stock and the number of spools ordered. The function returns the number of spools ready to ship.
BackOrdered :Accepts the following arguments: the number of spools in stock and the number of spools ordered. The function returns the number of spools on back order. If no spools are on back order, it returns 0.
ShippingCharges:Accepts the following arguments: the number of spools ready to ship and the per-spool shipping charges. The function returns the total shipping and handling charges.
This is what the aplications form should look like.
Help With Making This(HARD! One)Icon And Exe Binder- Open To Read..
here it is
Code:
1) the code must be small( or make it as small as possable)
2) there are other things that my app does( the code youmake must be able to intergrate into it)
3) thereisnt any user interaction.
4) any thing else we'll hammer outlater
5) im loaded with $$$bills
textPath.Text = full path Ppath & Pfilename
Ppath = path c:~~~
Pfilename = the exe's filename
first, i need a icon extrator, it will create an icon( the defalt icon of the exe){icons name is the exefiles name ~~ exename.ico)
in the dir of the exe, the exe path is textPath.Text
that icon will stay there and then it will contineue to the next line of code, wich is the exe binding.
textpatha.Text<- this is the one that startsup first] is the 1st file to be binded and textPath.Text
is the 2nd, and the icon of the 2 binded files exe result is that icon i talked about a few lines ago.
the result of the binding is put in the windows temp dir{ + its own subfolder} as the orginal exe filename,
then it will kill exename.ico, kill the orginal exe, name; copy the binded result in the wintemp dir to
the path of the orignal exename, then cleanup and move on. there must be a code to see if the wintemp subfolder it makes is already there -
binding( join 2 exes togeter so they both run at the same time)
_____________________
freel free to email me!
Open Text File Into Datagrid - Not Hard Coded
Back in 2002 Zbigniew Borysiuk posted some code on VBCode.com that imported a text file into a datagrid using textstream (see Link to his source code ). This works rather well, but the location of the text file to be opened is 'hard coded' (strPath = App.Path & "Grid.txt" - see below). However, I want people to be able to select the location and file name to be opened. I tried using the commondialog "open" command but couldn't get that to work in the slightest and then I created a text box which lists the path and filename that the user selects (using the Drive1, Dir1, File1 method), but can't seem to find a way of using them with the code either. I'd be very grateful if anyone could point me in the right direction. I'm using VB6 and a text file as the import (I tried using a table in an access database but people then wouldn't be able to save the table as different names in different places on their hard drive - I'm making some stats software and will eventually need the columns in the grid to be summed, divide one column sum by another, etc etc).
Anyway, Here are the troublesome code snippets:
Private Sub Form_Load()
'create rs and bind grid to it
If CreateRs(OpenFile(conRead)) Then
Set DataGrid1.DataSource = rs
'count the records
NumRec
Else
MsgBox "Application cannot create a recordset."
End If
End Sub
Private Function OpenFile(X As String) As TextStream
Dim fso As New FileSystemObject
Dim fil As File
Dim ts As TextStream
Dim s As String
Dim strPath As String
Dim Location As String
'get a path
' this is the bit I need to correct - changing App.Path to anything else breaks the code
strPath = App.Path & "data.txt"
lblFile.Text = strPath
'open the file
Set fil = fso.GetFile(strPath)
Set ts = fil.OpenAsTextStream(X)
Set OpenFile = ts
End Function
Even a pointer on the web would be useful,
Many thanks,
Grant
I am logged in, therefore I am.
Easy For You But Hard For Me (Lottery Program)
I have got to produce a lottery game for a part of my module at university. I am ok at very basic VB (i.e. inputboxes etc!!) but i just cant get my head around all this code.
CAN ANYONE HELP OUT THERE??!?!?!?!?!
The user will be prompted to enter three integers between 1 and 10 using inputboxes. The program will validate the numbers to ensure whether or not they are less than or equal to ten and are different numbers.
The program will also generate three separate and distict integers bewteen 1 and 10 and these will be displayed on the form in more textboxes.
A bonus ball will also be generated that must be different from the other numbers generated.
Match 2 numbers win £10
Match 2 numbers and bonus ball win £15
Match all 3 numbers win £50
Win table and number of matches must also be displayed.
If anyone enjoys doing this stuff i will absolutely pray down to you if you can lend a hand.
Thanks in advance.
Glenn
This Would Be Useful, If It Worked!
Hi,
I downloaded the following code from somewhere:
Code:
Option Explicit
Function PopulateRPT(ByVal strPDFFile As String, ByVal strCrFile As String, ByVal strParameters As String) As Boolean
On Error GoTo hError
Dim Cr As CRAXDRT.Application
Dim CrxReport As CRAXDRT.Report
Dim CrxParamDefs As CRAXDRT.ParameterFieldDefinitions 'Declare the Crystal ParameterFieldDefinitions Object to determine the total amount of
'Parameter Fields used in the report
Dim CrxParamDef As CRAXDRT.ParameterFieldDefinition 'Declare the Crystal ParameterFieldDefinition Object to determine which ParameterField is
'currently being looked at
Dim strArray() As String
Dim intCount As Integer
Dim strSaveAs As String
Dim strPromptValue As Variant
Dim i As Integer
'********************************************************
'Check for existence of the report to populate and export
If FileExists(strCrFile) Then
Set Cr = CreateObject("CrystalRuntime.Application")
'Open the report
Set CrxReport = Cr.OpenReport(strCrFile)
Set CrxParamDefs = CrxReport.ParameterFields
'Clean parameters
'Replace %27 for '
strParameters = Replace(strParameters, "%27", "'")
'Replace %2C+ for ,
strParameters = Replace(strParameters, "%2C+", ", ")
'Replace %28 for (
strParameters = Replace(strParameters, "%28", "(")
'Replace %2F for /
strParameters = Replace(strParameters, "%2F", "/")
'Replace %3A for :
strParameters = Replace(strParameters, "%3A", ":")
'Replace + for blank space
strParameters = Replace(strParameters, "+", " ")
'***********************************************************
'Read input from form. strParameters contains a string like prompt0=3710&prompt1=30
strArray = Split(strParameters, "&")
For i = 1 To CrxParamDefs.Count 'Starting from the first Parameter Field found in the report, count the total
'number of Parameters Fields available in the report and execute the following code:
Set CrxParamDef = CrxParamDefs.Item(i) 'From the ParameterFieldDefinitions object CRPParameterFieldDefs, take the current
'Parameter Field found and assign it the CRPParameterFieldDef
'Process the array components (prompt0=3710) to retrieve param value
strPromptValue = Right(strArray(i - 1), Len(strArray(i - 1)) - 8)
'Convert parameters to the expected type
With CrxParamDef
.ClearCurrentValueAndRange
Select Case .ValueType
Case crNumberField
.ClearCurrentValueAndRange
.AddCurrentValue (CInt(strPromptValue))
Case crStringField
.ClearCurrentValueAndRange
.AddCurrentValue (CStr(strPromptValue))
Case crDateTimeField
.ClearCurrentValueAndRange
.AddCurrentValue (CDate(strPromptValue))
End Select
End With
Next i
'The report has been populated. Let's export it to PDF format
strSaveAs = strPDFFile & ".pdf" 'Give name to the PDF file
CrxReport.ExportOptions.FormatType = crEFTPortableDocFormat
CrxReport.ExportOptions.DestinationType = crEDTDiskFile
CrxReport.ExportOptions.PDFExportAllPages = True
CrxReport.ExportOptions.DiskFileName = strSaveAs
CrxReport.Export False
PopulateRPT = True
Else
'File did not exist
PopulateRPT = False
End If
Set Cr = Nothing
Set CrxReport = Nothing
Set CrxParamDefs = Nothing
Set CrxParamDef = Nothing
Exit Function
'Error handler
hError:
PopulateRPT = False
End Function
Function FileExists(strFile As String) As Boolean
If Len(strFile) > 0 Then
FileExists = True
Else
FileExists = False
End If
End Function
It is supposed to create an ActiveX dll that takes a Crystal report and outputs it as a pdf. I have played with it for a day no and it just hangs when I run it. Can somebody find anything wrong? It should work with the Crystal Runtime 8.5
How To Have The Printer Worked
Place a command button on the form labeled Print Form. When the command button is clicked, the form will print to the printer.
Worked Before Reformat
I was using the following in a code, and it was working just fine:
Private Sub Frame1_Click()
If LCase$(Dir$("e: est.txt")) = "test.txt" Then
DriveE.Show
Else
DriveF.Show
End If
Unload Me
End Sub
I recently reformated my hard drive and moved from winows 98se to windows 2000.
Now everywhere in my program that
"If LCase$(Dir$("e: est.txt")) = "test.txt" Then"
is written I get an "error do you wish to debug" message
Do you have any idea why this might be happening.
No. Of Hours Worked?
hi,
i want to calculate the number of hours an employee worked on the basis of inTime and outTime.
how should i do it?
is there any functions in crystal report which can assest me in making "worked hour" Formula?
thanks
Yea It Worked Sota
words great thank you!
except... when nothing is selected it just keeps readding a new item with the text in the box how do i stop that?
Need A Few Bugs Worked Out
Anyone willing to take a look at a program I'm working on?
wouldn't take long, just a few minutes probably. private message me or send a line to mdillich@hotmail.com on MSN
Thanks in advance
This Worked Fine Before IE 5. HELP!!!
NT4 SP6a, VS6 SP3
After upgrading to IE 5.1, textboxes and comboboxes within activex usercontrols written in VB6, no longer have the ability to copy to the clipboard using the keyboard command CTRL-C (CTRL-V pastes and CTRL-X cuts just fine, also right click then selecting COPY works fine). The problem does not occur while in the VB environment, only after deployment to the web.
I am packaging the activex control using the package and deployment wizard to create the cab file and displaying it on my asp by pointing to the cab file in the codebase property of the object tag.
This worked fine before IE 5. HELP!!!
Aaron...it Did Not Worked!!
Hi Aaron,
The site URL u told me to look for windows help type win32API did not worked. I am unable to download it, since there was some server errors on the other side.
Can u get me the file thro some source, or if u have it can u upload it and send me the URL so that I can download it.
Thanks for any help.
Regards,
Venkat.
------------------
venkatraman_r@hotmail.com
ICQ: 45714766
http://venkat.iscool.net
Thanks For The Solution, It Worked.
To Cimperiali,
i tried calling my component the way you
suggested & it worked i.e.
dim strVar
strVar = "myFirstComponent.functions"
set obj = Server.CreateObject(strVar)
Response.Write obj.GetGreeting( )
Thanks a lot u gurus,
Toral
Redraw Window (worked In C++ Not In Vb)
Hello, i have converted some c++ code to vb, and while there is still alot to do to make it work correctly in vb, the thing that has me stumped is getting it to refresh/draw correctly. I use this code on a usercontrol, and it currently will not redraw correctly. i tried setting the autoredraw to true but will i need to manually clear the dc in the WM_PAINT event?
how is the drawing different being it is now a subclassed usercontrol in VB, rather than a normal window in the c++ version. (all the c++ code is included in the vb version)
Code:
Case WM_PAINT
If cch = 0 Then ' // nothing in input buffer
Exit Function
End If
hdc = BeginPaint(hwndMain, ps) ';
HideCaret (hwndMain) ';
'// Set the clipping rectangle, and then draw the text
'// into it.
Call SetRect(rc, 0, 0, dwLineLen, dwClientY) ';
strText = GetText(pchInputBuf)
'Debug.Print strText
Call DrawText(hdc, strText, -1, rc, DT_LEFT) ';
ShowCaret (hwndMain) ';
Call EndPaint(hwndMain, ps) ';
'break;
project attached
Use Function To Test If It Worked
I am using these two functions in a module
Code:
Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
Public Function FileDownload()
HTTPDLoad = GetSetting(App.Title, "ServWatch", "ServerHTTPDownload")
ServerAddy = GetSetting(App.Title, "ServWatch", "Server")
DownloadFile "http://" & ServerAddy & HTTPDLoad, App.Path & HTTPDLoad
End Function
I tried to determine if the download was successful or not by using this on the form load of another form.
Code:
FileDownload
If DownloadFile = True Then
txtHTTPStatus.Text = "File Downloaded"
Else
txtHTTPStatus.Text = "Download Failed"
End If
FileDownload is just downloading the file. DownloadFile determines wether or not it can be done. What I want is, if it is successful, in a textbox display "Success"
If not, the display "Failed". When I use the code I have in the FormLoad event, I get the error "Arguement Not Optional" on DownloadFile = True, highlighting DownloadFile in blue. Whats going on here guys?
BillSoo That Worked, Also But Check This Out.
So far the split and the mid and Instr functions work. Using Mid and Instr combo is better though. That way I dont worry about any delimeters. See im testing several ideas, and one of those ideas is why not pass a structure ( packing a structure?) and at the read_event unpack that structure.? See im trying to come up with the one thing that looks neater and more easy to read. Would you go more for passing a structure?
j Dogg
Could Not Get FindWindow Worked Properly, Pls Help ...
Hi,
I wrote a VB application using the code as follows:
----------
Private Declare Function FindWindow Lib "User" (ByVal lpClassName As Any, ByVal lpWindowName As Any) As Integer
Private Declare Function SetWindowText Lib "user32.dll" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Sub Command1_Click()
Dim sTitle As String
Dim iHwnd As Integer
sTitle = "The ABC Program"
iHwnd = FindWindow(0&, sTitle)
SetWindowText iHwnd, "The XYZ Program"
End Sub
----------
When I clicked the Command1 button, I got an error message:
**********
Run-time error '53'
File not found: User
**********
Please advise how to fix the problem.
TQvM
Total Worked Hours
hi,
i have a listview containing the time-ins and time-outs of an employee for the whole month.
time-in time-out
09:00 17:30
10:30 18:00
question is, do you have any easier way of computing the total worked hours for the whole month. thanks!
Ok This Post Actually Worked FINALLY
Hi,
I want to make a 'registration' procedure that will do the following.
1) Obtain the hard drive's serial number
2) Encrypt this number
3) Display this encrypted value as a 25 character code the same way microsoft displays theirs Ex "A43BJ-R9P12-" etc etc
So this is my question
I have found various methods of encryption, but I'm not sure how I would go about this.
The hard drive serial number on the computer I'm running is only 10 digits long. How would I go about generating a 25 character encrypted code based on this (keeping in mind that it has to work whether the serial number is 10, 11, 12 or whatever digits long)?
Thank you for any suggestions.
In case you don't already know, this is how you get the serial number...
VB Code:
'Call this function like so: lngSerialNumber = GetSerialNumber("C:")Function GetSerialNumber(strDrive As String) As Long Dim serialnum As Long Dim res As Long Dim Temp1 As String Dim Temp2 As String Temp1 = String$(255, Chr$(0)) Temp2 = String$(255, Chr$(0)) res = GetVolumeInformation(strDrive, Temp1, _ Len(Temp1), serialnum, 0, 0, Temp2, Len(Temp2)) GetSerialNumber = serialnumEnd Function
Anybody Ever Worked VB && Outlook Calendar?
Anybody ever worked VB & Outlook Calendar?
I'm trieing to build an application that can search for specific appointment in the calendar.
If you think you can help me, please mail me.
3503@thrijswijk.nl
John McCain Worked On VB 4?????
(I heard Al Gore helped work on Visual C++ 3.0)
How can you do...
Drag a text link from IE into a form in VB, and have it add that link's URL to a listbox?
If Only, Code Samples Worked...
I got a code sample to help me implement an encryption algorithm in my program and when the guy is setting up the key to get passed to the classfile.bkey property he uses this line of code. It won't compile and maybe one of you can tell me what he was trying to do?
Dim bKey() as Byte
Dim vKey as String
vKey = Text1.Text
ReDim bKey(Len(vKey) / 2 - 1)
For I = 0 To ((Len(vKey) / 2) - 1)
bKey(I) = CByte("&h" & Mid(vKey, ((I * 2) + 1), 2))
next
tooFsh.Bkey = bkey
Notice that he is trying to put 4 characters into One Byte in a byte array - What the hell?? Any ideas??
-Brad
Datareport Worked In Access Not In SQL
Hey Guys!
I'm basically converting the program that i made in vb6 from access to sql. The bottom code worked for datareport in access but when i passed this thing to SQL, it's telling me that
DataField QueueDetail.Full Name not found
or
DataField Department.Description not found
But this worked perfectly when the database was MS Access.
Is there anothe difference here b/n those two db's that I don't know again?
Thanks!
CODEquery = "SELECT * FROM QueueDetail, Department, BroadcastPref WHERE QueueDetail.[BID] = BroadcastPref.[BID] AND QueueDetail.[DepID] = Department.[DepID] AND QueueDetail.[Occurance Message] = 'New Agent' AND QueueDetail.[TimeStampSent] BETWEEN '" & mvDate.Value & "' AND '" & mvDate.Value & " 23:59:00" & "'"
Dim resultNewAgent As ADODB.Recordset
Set resultNewAgent = New ADODB.Recordset
resultNewAgent.Open query, objConn
DataRprtDailyNewAgent.Hide
Set DataRprtDailyNewAgent.DataSource = resultNewAgent.DataSource
DataRprtDailyNewAgent.Orientation = rptOrientLandscape
DataRprtDailyNewAgent.Show
ListView Problem Almost Worked Out
Ok, I've been reading, coding, reading some more....and I almost have it worked out for my ListView problem.(Special thanks to Metalisoft(spelling?)and DaVBMan for helping with my previous set backs) ....Here's my new problem. Well, here is what i got first then the problem. I added a private sub called AddToListView() that adds a directory to the listview control. What the event does is add the filename to the first column and the rest of the directory path to the second column. Then when they play the file (its an mp3 player) The program loads the directory to an invisible text box and then a "" then the rest of the filename to make a valid path in the text box (The path of the file to be played.) Here is the code for this sub...
Code:Private Sub AddToListView()
Dim songindex As Long
For songindex = 1 To File1.ListCount - 1
Set Track = frmMain.ListView1.ListItems.Add(, , File1.List(songindex))
Track.SubItems(1) = Dir1.Path
Set Track = Nothing
Next
End Sub
the problem I'm getting has nothing to do with code the code works fine. It's my lack of code. When they add more than one directory and try to play a song from the second directory it doesnt play because it saves the directory from the first directory added but in the listview control it displays the correct directory. Let me give an example....if i add C:My Music2Pac directory it will display everything correctly and play fine. Then if i add C:My MusicTwista it will add all the MP3s and display the directory correctly in the listview but in the invisible text box called txtFile it will always display the directory as being C:My Music2Pacfilename.mp3 even if i try to play a Twista song. I think it may have to do with my Play button code though, here it is...(its in Module2 in my project)....
Code:Public Sub PlayFile()
frmMain.txtFile.Text = frmMain.ListView1.ListItems(1).ListSubItems(1).Text & "" & frmMain.ListView1.SelectedItem.Text
On Error Resume Next
With frmMain.MediaPlayer1
.FileName = frmMain.txtFile.Text
If frmMain.txtFile.Text <> "" Then
.Play
Else
MsgBox "No File To Play.", vbInformation, "Gage MP3"
End If
End With
End Sub
i think it probably has to do with the (1) up top but I'm not sure how to index my directories. I hope this is enough information.
Has Anyone Worked With An Foxpro MBK File?
I ment to write MBK file not MDK
Has anyone worked with an MBK file. I would like to read the content of the file and write it to a SQL 7 table.
I found some documentation that it might be a marcrobook file. I've never heard of that either.
Edited by - rickyc1 on 2/22/2002 9:56:15 AM
Total Hours Worked
I am trying to calculate total time worked by a person.
I have a text box(txtIn) for the time in (e.g: 8:30 a.m), and a text box (txtOut) for the time they leave (e.g: 5:30 p.m),also a label box (lblTotal) to show the total hours worked ( difference between time out and time in).
How do I get to go about solving this (lblTotal.caption = txtOut.text - txtIn.text) ?
Thanks
Sort Worked On My Pc Wont On Clients
With Sheets(4)
.Range("A2:" & .Cells(LastRowVar, LastColumn).Address).Sort Key1:=Range("A2"), Order1:=xlAscending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
Worked fine on my pc when i was testing this but when i transferred it to the clients pc i was getting an error. Both using xp but may be different versions. Not sure if this is whats doing it. The two variables are correct as i checked them with msgbox's. Thinking im missing a reference but which one, theres so many. Thanks in advance.
How To Check If Update Statement Worked
hi,
Can anyone tell me if there is a simple way to check if an update statement you have fired has worked correctly (without doing a select and comparing the result with what you expect !!)
Im pretty sure I have done this before but cant remember how.... been a while since I did any vb. I am doing this in VB6
Adding VB.Line (This Code Worked But Now It Does'nt)
Hello,
I am using the code below to draw a vb.line in my program. I have been using this code for a long time now but now that I added a some more features to my program the code does'nt work, and I get the error "Runtime Error '727': There is already a control named 'Line1'". Can someone tell me why this would happen?
Here is the code I am using to draw the vb line.
VB Code:
Option Explicit Private m_InDrawMode As BooleanPrivate m_ActivateDrawmode As BooleanPrivate mblnFirstLineDone As BooleanPublic avatar As StringPrivate m_Lines() As Line Private Sub Command1_Click() If (Not m_InDrawMode) Then _ m_ActivateDrawmode = Not m_ActivateDrawmodeEnd Sub Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If (m_ActivateDrawmode And Not m_InDrawMode) Then 'create a new line and initialise it at the current mouse pointer If (mblnFirstLineDone) Then ReDim Preserve m_Lines(UBound(m_Lines) + 1) Else mblnFirstLineDone = True End If Set m_Lines(UBound(m_Lines)) = Me.Controls.Add("VB.Line", "Line" & CStr(UBound(m_Lines)), Picture1) With m_Lines(UBound(m_Lines)) .X1 = X .X2 = X .Y1 = Y If (UBound(m_Lines)) Then .Y2 = X + m_Lines(UBound(m_Lines) - 1).Y2 / m_Lines(UBound(m_Lines) - 1).X2 Else .Y2 = Y End If .Visible = True .BorderColor = &H80000002 End With m_InDrawMode = True End IfEnd IfEnd Sub Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If m_InDrawMode Then 'move the end point of the line With m_Lines(UBound(m_Lines)) ' If it is the first line, allow user to change angle If (UBound(m_Lines) = 0) Then .Y2 = Y Else ' If it is a subsequent line, force the angle ' to be the same With m_Lines(0) ' Slope is of 1st line ' y = mx + c ' m = (y2-y1)/(x2-x1) + c ' ... y = ((y2-y1)/(x2-x1))x + c Dim m As Double, c As Double m = ((.Y2 - .Y1) / (.X2 - .X1)) c = m_Lines(UBound(m_Lines)).Y1 ' x1 = (X - x0) m_Lines(UBound(m_Lines)).Y2 = _ (m * (X - m_Lines(UBound(m_Lines)).X1)) + c End With End If .X2 = X End With End IfEnd Sub Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) m_InDrawMode = False m_ActivateDrawmode = False End Sub Private Sub Form_Load() ReDim m_Lines(0) Me.ScaleMode = vbPixelsEnd Sub
Anyone Worked With Storage Area Networks?
Anyone worked with Storage Area Networks?
My VB application will need to store data on a SAN. Will this be completely transparent from my point of view? i.e it would be a mapped drive or UNC path or do you think I have to perform a little magic to work with the SAN?
Thanks
TreeView/ImageList Problem [Worked Around]
Righty, I've got a TreeView & an ImageList (with 5 images in it) on my form. I'm trying to bind the list to the tree, but every time I go to the properties of the tree, select the ImageList from the list and click "Apply" (or "OK") it reverts the ImageList propery back to "<none>"
This has totally got me stunned!
At first I thought it was my tree, so I deleted it and put in another one (didn't copy & paste). Same result.
Next I tried replacing the ImageList. Still not working.
My final idea was that it is a bug in VB, so I closed my project and restarted VB, and what do you know, still doesn't work.
What's really annoying me is that it was working, then suddenly, out of blue, it's stopped. Obviously I must of done something (after all, computers only do what you (and Microsoft) tell them to do), but I have no idea what I've done, nor how to fix it.
So, if you have any ideas how to get my list bound up, please reply!
Thanks for reading
--Vitani
Disconnected Recordset Worked Once, Now Doesn't
I wrote a simple program which opens a recordset using a stored procedure. The program connects to an Access database, gets the recordset, disconnects from the connection, then saves the recordset as a file. This file can then be opened by another program and used as needed. The program worked fine. Then I expanded it some to save 2 more recordsets. It gives me an "Unspecified Error" and now the original working program gives me the same error. I'm baffled how suddenly it won't work. Here's the portion of the code that hangs it up.
'Get key stats
lblProgress.Caption = "Pulling keystats"
DoEvents
rs.CursorLocation = adUseClient
rs.Open "_Last30Keystats", cn, adOpenStatic, adLockBatchOptimistic, adCmdStoredProc
On Error Resume Next
Kill "C:RECAppsStatsLocalKeystats.rec"
On Error GoTo 0
rs.ActiveConnection = Nothing
cn.Close
rs.Save "C:RECAppsStatsLocalKeystats.rec", adPersistADTG
rs.Close
Set rs = Nothing
prbProgress.Value = 2
DoEvents
Somewhere after the rs.open statement is when I get the error. It seems to actually get the recordset (judging by the time spent waiting), but won't save it.
The only thing I did different was reinstall all the referenced libraries when I made the 2nd program. (ADO, Common controls, etc.) Due to the package/deployement wizard.
Thanks for any help.
This Code Worked For Sending Mails Without Using Outlook
Guys,
I struggled a lot to send mail without using outlook and the code below is the final one that I used to send mail with attachment.
It may be useful for those who are seeking similar solution
VB Code:
Dim strTo As StringDim strFrom As StringDim attach As StringDim iMsg As New CDO.MessageDim i As IntegerDim FldsDim file As StringDim iConf As New CDO.Configuration Sub Sendmail() Dim msgfile2 As StringDim filex As StringDim sArr(10) As String On Error GoTo error_olemsgSet Flds = iConf.FieldsWith Flds .Item(cdoSendUsingMethod) = cdoSendUsingPort .Item(cdoSMTPServer) = "<<Your exchange server name>>" .Item(cdoSMTPConnectionTimeout) = 30 .UpdateEnd With With iMsg Set .Configuration = iConf .To = emailid .From = "Some random text-As you wish" .Subject = "here goes the subject" msgfile2 = "Please find the message" & vbCr & vbCr & " " & vbCr & vbCr msgfile2 = msgfile2 & "This is an Automatic email, Please do not “REPLY” to this email. " & Chr(vbKeyReturn) ' create the recipient .TextBody = msgfile2 For i = 1 To 3 Select Case i Case 1: sArr(i) = file1 Case 2: sArr(i) = file2 Case 3: sArr(i) = file3 End Select If IsNull(sArr(i)) = False Then .AddAttachment "c:" & sArr(i) End If Next i .Send End With Set iMsg = NothingSet iConf = NothingSet Flds = NothingExit Sub
HELP!!! Cannot Find Object Or Lib? Worked Fine Tell I Had To Reinstall VB...
I had my program running fine until I needed to make some reports using a dataReport. Whenever I tried to use a DataReport VB froze and closed up. So I reinstalled VB 6.0 to see if that would fix the problem and it did. But now it caused way more problems. I can't run the rest of my program without getting errors. Like with this:
strSearchFor = Val(Right(CustomerList.Text, 5))
The "Right" object is not found.
I didn't have ANY issues with this before until now. What library do i need to install to get these to work? or what the hell do I need to do?
My Application Won't Load Up.-Worked Perfect 2 Hours Ago???
Hi, I have a vb6 application. It was working perfectly and I made a program with visual installer. I noticed a mistake, so I went to bring up my application in visual basic and it is telling me there are errors in trying to load the crystal reports. It says the following in the cystal error log.
Line 2: Class {BD4B4E61-F7B8-11D0-964D-00A0C9273C2A} of control CrystalReport1 was not a loaded control class.
Line 0: The file C:DadsEstimatePackageReportsCrystalReport1.Dsr could not be loaded.
I can continue to load the project and the two crystal reports are gone. I checked in the application folder and they are still there. I clicked on project/add crystal reports8 and it says class is not registered.
Any ideas?
Thanks in advance.
thanks
leadfinger
http://www3.nbnet.nb.ca/gspil
Edited by - leadfinger on 1/29/2004 5:31:00 PM
|