|
You could use File.ReadAllLines to read the text as a string array then look for strings that start with Name: ( etc ) and parse out the values.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am writing a program to update some of my files that I have on other computers. It is simple and just transfers the files from a cd to a given location. The location is a read-only folder. I need to change this property by using code before I can copy the new file to the location and then return the folder to read only. I already have the code to transfer the folder but I need to code to change the property of the folder from read-only = true to read-only = false. This needs to occur before the file is moved. I do not know where to start so any help will be appreciated.
I have this:
Dim str_ToPath As String = "C:\Folder\myFolder"
Dim str_FromPtath As String = System.IO.Directory.GetCurrenDirectory()
Dim localfile As String = "myfile"
Dim fso, file
' Get handles to folders current location.
fso = CreateObject("Scripting.FileSystemObject")
'Here is where I need the code to check if the folder is read-only or not and
' change if it is read-only. The folder will be the str_ToPath folder.
file = fso.GetFile(str_ToPath + localfile)
' Delete the folder.
file.Delete()
file = fso.GetFile(str_FromPath + localfile)
' Copy the file to correct location.
file.Copy(str_ToPath + localfile)
|
|
|
|
|
ChadYKK wrote: System.IO.Directory.GetCurrenDirectory()
So this is VB.NET ?
ChadYKK wrote: fso = CreateObject("Scripting.FileSystemObject")
Why on earth are you doing this ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
VB 2005, I am using the fso object to delete files and move files to other locations.
|
|
|
|
|
Hi,
I create VB.NET applications/utilities for the company I work for and I was wondering what is the policy for using the VB Controls from Code Project in these VB.NET applications/utilities?
I have been looking around the Code Project web site and cannot find anything written specifically about use of code/controls for commercial use, guess I have not been to the right place.
I have seen some good controls here and I do not want to reinvent the wheel, but I need to know if I can use them or require permission or what not.
Thanks,
Jamie
|
|
|
|
|
The general idea is that you can use them, but the sensible approach is to ask the authors of the controls you want to use.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How would you contact the Author, add a message in the Discussion at the bottom of the Article? Is there a way to contact them directly?
Jamie Parsons
|
|
|
|
|
Hello all,
I have an app that requires a certain active X plug in be installed. During testing, if i uninstall the active x control, I am presented with a rather nasty error. I have trapped other error messages with...
<br />
'Unhandled exception error<br />
Dim WithEvents ap As AppDomain<br />
<br />
<br />
Private Sub ap_UnhandledException(ByVal sender As Object, ByVal e As System.UnhandledExceptionEventArgs) Handles ap.UnhandledException<br />
<br />
Try<br />
WriteErrorLog(e.ToString)<br />
Catch ex As Exception<br />
WriteErrorLog(ex.ToString)<br />
End Try<br />
<br />
End Sub<br />
How can i capture this one too?
|
|
|
|
|
remove the variable and the 'handles' from the subroutine.
AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf ap_UnhandledException
|
|
|
|
|
I am doing a game of Blackjack. I have only one problem to figure out.
I cannot get the dealers cards to add up if it is more than two cards.
i am giving two cards to the dealer on the on the first deal. I can get the dealers total hear, but i can't get the totals if the dealer needs more than two cards. I am using arrays for the cards and card values plus piture boxes. I also have an array for the players and dealers last four cards. The players four extra cards i have on a click event. It is just the dealers totals i cannot work out.
Regards
Zeldacat
|
|
|
|
|
You're going to have to give us more information about what is going wrong in your code. Are you getting an error? What code are you using right now?
|
|
|
|
|
Are you storing the value of the dealers cards in an array? If so, is it large enough to hold as many cards as he has? Some example code may help get you an answer.
|
|
|
|
|
Thank you all. Sorry, I do have problem describing details about things.
I have changed the arrays around a bit, so i can now do the total scores.
Once again thank you.
Regards
Zeldacat
|
|
|
|
|
Just as an FYI rather than making a sub-post it's more helpful if you modify your message title with [SOLVED] behind it.
|
|
|
|
|
I haved used a VLOOKUP to select the field i require, however i need to select all fields that appear in this column and put them in a table. VLOOKUP will only selects the first cell in the column where this data appears. How can i get it to loop round all of them?
|
|
|
|
|
Hi all
Im trying to connect to a mysql db on a remote host using vb.net (windows ) but I get the following error message
Unable to connect to any of the specified mysql hosts
Here is the code im using to connect to the local and remote servers
Please note that this code works fine on the local
Dim mydatabase As String = "gdfgdfg"
strServername = "dfgdfg"
pword = "dfgd"
Dim userid As String = "dfg_31"
Dim MySQLConnectionString = "Server=strServername;" & _
"Database=myDatabase;" & _
"Uid=userid;" & _
"Pwd=pword;" & _
"Connect Timeout=30;"
Or
Dim dbConn As New MySqlConnection("Server= '" & strServername & "'; Database=payperclick; User ID='" & userid & "' ; Password='" & pword & "';")
Dim dbConn As New MySqlConnection(MySQLConnectionString)
Try
dbConn.Open()
dbConnect = dbConn
Catch ex As MySqlException
MsgBox(ex.Number & vbCrLf & ex.Message & vbCrLf & ex.Source)
Please note that this code works fine on my local pc
im a junior developer at a company called securemail in south africa
|
|
|
|
|
Is "Remote Connection" enabled on the host in question? If not you won't be able to connect to it.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
hi,
thanx for the response.
im not sure of whether remote access is enabled on the host but, ive got colleagues who can connecting to the host using php.
does this mean that remote access is enabled
im a junior developer at a company called securemail in south africa
|
|
|
|
|
Hi,
I have the following code, and my application falls into the if statement and exits but i cant find why. Can anyone tell me the solution.
--------------
Private Sub TimerInitialize_Timer()
'On the simulator, use the TmpMdb data base, that contains the new elemets.
'On the server pass "" to use the default data base (MDB).
TimerInitialize.Enabled = False
If InitSystem() <> True Then
'Can't start
Application.Exit()
End If
'#If afServiceEnabled Then
' NTServiceCtrl.StopService
'#End If
End Sub
--------------
the InitSystem code is the following.
---------------------------------------
Public Function InitSystem() As Boolean
'-------------------------------------------------------------------
' Initialize and start the system. Called from the main Load_Form.
' Inputs: none ' Outputs: none
'-------------------------------------------------------------------
Dim DnList As Collection
Dim MyDn 'must be variant to enumerate collection items
Dim ch As Long
'The following causes: [32021] TAPI properties not supported in this build:
'Dim myLineApp As Long 'myLineApp = LineGroup1.AppHandle(1)
'Open data base
myDataAccess = New DatabaseAccess(Application.StartupPath)
'Setup path to the MediaPath repository location
SysOptions.sMsgRepositoryPath = Environ(CTIDIR_TOKEN)
If SysOptions.sMsgRepositoryPath = "" Then
'No set in the environment, use default
SysOptions.sMsgRepositoryPath = CTIDIR_DEFAULT
End If
' Set the voice directory path
MainFrame.VoiceDirectory = SysOptions.sMsgRepositoryPath & VAP_FILE_DIR
' Start the engine
MainFrame.StartSystem(False)
'On Error GoTo Err_InitSystem
DnList = GetDnListToMonitor(APP_NAME)
BugMessage("Number of entries: " & CStr(DnList.Count))
If DnList.Count > 0 Then
'Found some valid channels
iMaxChannel = 0
iMinChannel = 1000
For Each MyDn In DnList
ch = DirectoryNumToTapiDeviceID(0, MyDn)
If ch = -1 Then
BugMessage("Unknown TAPI device name: " & MyDn)
Else
'Channels can be added dynamically but only after StartSystem.
'Also, you must add 1 to the raw TAPI device ID for AddChannel.
ch = ch + 1 'Must add one
MainLineGroup.AddChannel(ch)
If ch > iMaxChannel Then
iMaxChannel = ch
End If
If ch < iMinChannel Then
iMinChannel = ch
End If
BugMessage("Added ch:" & ch & " for " & MyDn)
End If
Next MyDn
'Allocate per channel data for all channels
ReDim CallData(0 To iMaxChannel + 1)
Else
'No chanels to monitor, it's not gonna work...
BugMessage("InitSystem: No channels to monitor")
InitSystem = False
Exit Function
End If
' Initialize global System Options from MediaPath data base
mdbGetSysOptions(SysOptions)
InitSystem = True
Exit Function
Err_InitSystem:
If Err.Number = 32302 Then 'System already running
BugMessage("InitSystem: system already started")
Err.Clear()
Resume Next
End If
BugMessage("InitSystem: [" & Err.Number & "] " & Err.Description)
Err.Clear()
InitSystem = False
End Function
-- modified at 10:13 Monday 5th November, 2007
|
|
|
|
|
Have you tried setting a breakpoint and walking through the program? You should be able to tell while walking through it where the program gets a value that you weren't expecting.
|
|
|
|
|
i did,
" TimerInitialize.Enabled = False
If InitSystem() <> True Then
'Can't start
Application.Exit()
End If" this is where it exits.
|
|
|
|
|
Right...but that means that InitSystem is returning a true value, and I'm guessing you were not expecting a true value.... unless that is your problem right there. Did you mean to say If InitSystem() = False????
If not, debug into the InitSystem and see why it is returning true.
|
|
|
|
|
My Visual Basic 6.0 program allows me at home to Write to and Read from Random Access files and, and to produce in the end a paper sheet with results. In fact I entry the raw scores of a psychological test and after 'treatment' the program comes up with the results. I would like to make a website which I can approach from any computer to achieve the same. Is that possible and what means should I use?
Paul
|
|
|
|
|
|
DigiOz Multimedia wrote: I had a long discussion about this topic on a different forum/website. Take a look at this thread:
http://www.programmingtalk.com/showthread.php?t=28166&highlight=automate+website[^]
Also, the following post may help:
http://www.codeproject.com/script/comments/forums.asp?msg=2218907&forumid=1646&mode=all&userid=1587313#xx2218907xx[^]
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
Hi Pete,
Thank you for your fast reply. Really in the way computers should work
Allthough I learned a lot from it, it did not solve my problem.
Maybe I stated my problem in the wrong way.
Let me put it this way then:
Is it possible to upload a "normal" Visual Basic 6.0 program into the server of my webhost and make it approachable from my home computerso that I can entry data into that program and make it print results on my home printer?
I am ok with VB but a newbie considering web things
Thanks,
Paul
The Netherlands
Paul
|
|
|
|