15,892,537 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by KevinBrady57 (Top 56 by date)
KevinBrady57
3-Sep-15 17:26pm
View
Yes, I will accept your answer. I meant to do that earlier. Sorry.
KevinBrady57
3-Sep-15 12:52pm
View
Sergey, Thanks for the response. I implemented the methodology you suggested and it works exactly as I need it. It is also much simpler and more straightforward.
I would like to know, however, why the "invoke" method does not work.
KevinBrady57
11-Feb-14 18:47pm
View
If I replaced the "^" character with a "‡", File.ReadAllLine does not recognize at and it cannot be split.
KevinBrady57
11-Feb-14 17:04pm
View
Now I understand the problem I am having more fully. Thank you Sergey.
The problem is not with the split command, but with reading the data from the file. I use the following code to read the entire data file: Dim ostr() As String = File.ReadAllLines(FullFileName). Each array element is one record, such as: 20001^1000^1^4850^E Speedway^^Tucson^1004^85712^^63270. In this case, the record fields are delimited by the "^" character. I have a method that will populate the correct fields by splitting this record based on the specified character. The mentioned vb.net function to read the entire data file does not "recognize" the delimiter character if it is greater than ascii 127. Is there a way to get the File.ReadAllLines(FullFileName) function to recognize extended ascii characters?
KevinBrady57
6-Jan-14 13:18pm
View
Never mind. I figured it out.
KevinBrady57
6-Jan-14 13:12pm
View
Is there a way to "force" the subkey to be created off the root (i.e. "Software)" instead of the Wow6432Node?
KevinBrady57
6-Jan-14 12:03pm
View
That's where it was. Thanks
KevinBrady57
15-Oct-13 18:08pm
View
So, nobody knows what the problem and or solution is? FYI - in my original message I wrote "lost_focus". This was a typo. I meant to write LostFocus.
KevinBrady57
22-Sep-13 16:28pm
View
Deleted
Here is the function I developed:
Public Function DownLoadWebFile(ByVal iSiteAddr As String, ByVal iFileName As String) As Boolean
DownLoadWebFile = False
If IsPath(FilePathOnly(iFileName)) = False Then
' the path to the file does not exists
Exit Function
End If
' delete the existing file if it exists
DeleteFile(iFileName)
Try
Dim iRequest As System.Net.HttpWebRequest
Dim targetURI As New Uri(iSiteAddr)
iRequest = DirectCast(System.Net.HttpWebRequest.Create(targetURI), System.Net.HttpWebRequest)
If (iRequest.GetResponse().ContentLength > 0) Then
Dim str As New System.IO.StreamReader(iRequest.GetResponse().GetResponseStream())
File.WriteAllText(iFileName, str.ReadToEnd)
str.Close()
DownLoadWebFile = True
End If
Catch ex As System.Net.WebException
'Error in accessing the resource, handle it
MsgBox("ERROR! IOException " & vbCrLf & ex.ToString, , )
End Try
End Function
KevinBrady57
22-Sep-13 12:19pm
View
Thank you very much for your response. This was all very helpful.
KevinBrady57
10-Feb-13 15:34pm
View
Here's one link I found: http://support.godaddy.com/help/article/1073/using-cdosys-to-send-email-from-your-windows-hosting-account
I modified my original code to use: SmtpServer.Host = "relay-hosting.secureserver.net"
SmtpServer.Port = 25
SmtpServer.EnableSsl = False
It throws the "Unable to connect to the remote server" ...
KevinBrady57
10-Feb-13 12:27pm
View
I understand. I tried testing it without a from address, and it wouldn't work. It doesn't work if I use some other email address other than my Yahoo one.
Also, do you know if they same thing can be done using Go Daddy (i.e. secureserver)? I tried it last week using code I found on-line, but couldn't get it to work.
KevinBrady57
10-Feb-13 12:11pm
View
This works. Thank you very much. I had to change the "From" address to my yahoo email address. Does there have to be a "From" address?
KevinBrady57
9-Feb-13 21:56pm
View
Yes. At the class definition Is "Imports System.Net.Mail"
KevinBrady57
8-Feb-13 11:05am
View
I added a reference to Microsoft.Office.Interop.Outlook in the project. The call to create the Outlook.Application object still bails-out. Below is the code for the entire subroutine.
Sub SendOutlookEmail(ByVal iMsgBody As String, ByVal iMsgSubj As String, ByVal iToEMailAddr As String, ByVal iAttachment As String)
' Create an Outlook application.
'Dim oApp As Outlook._Application
Dim oApp As Outlook.Application
Try
oApp = New Outlook.Application ' sub bails-out here
Catch e As Exception
MsgBox(e.Message)
End Try
' Create a new MailItem.
Dim oMsg As Outlook._MailItem
Dim oAttachs As Outlook.Attachments = oMsg.Attachments
Dim oAttach As Outlook.Attachment
oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)
oMsg.Subject = iMsgSubj
oMsg.Body = iMsgBody & vbCr
oMsg.To = iToEMailAddr
If iAttachment <> "" Then
Dim sSource As String = iAttachment
' TODO: Replace with attachment name
Dim sDisplayName As String = FileNameOnly(iAttachment) ' use the filename as the attachement name
Dim sBodyLen As String = oMsg.Body.Length
oAttachs = oMsg.Attachments
oAttach = oAttachs.Add(sSource, , sBodyLen + 1, sDisplayName)
End If
' Send the message
oMsg.Send()
' Clean up
oApp = Nothing
oMsg = Nothing
oAttach = Nothing
oAttachs = Nothing
End Sub
KevinBrady57
7-Feb-13 19:58pm
View
I did. Here's the code
Try
Dim oApp As New Outlook.Application
Catch e As Exception
MsgBox(e.Message)
End Try
No exception is reported. VS just returns to my main program form.
KevinBrady57
3-Feb-13 19:41pm
View
iFileNameTrailer = "_" & UniqueIdent(Today)
The UniqueIdent function is:
Function UniqueIdent(ByRef iDate As Date) As String
Dim iYear As String = iDate.ToString("yyyy")
Dim iDayOfYear As Integer = iDate.DayOfYear
Dim sec As Integer = iDate.Second
Dim min As Integer = iDate.Minute
Dim Hr As Integer = iDate.Hour
Dim iTime As Integer = sec + 60 * (min + 60 * (Hr))
' use the number of seconds since midnight, the day of the year & the 4 digit year
UniqueIdent = CStr(iTime) & CStr(iDayOfYear) & iYear
' add the users system identification
UniqueIdent &= "_" & CStr(ThisUser.Index)
' add a random number to the end
UniqueIdent &= "_" & CStr(RandomNumber()) ' add a random number to the end of it
End Function
KevinBrady57
4-Jan-13 11:02am
View
Thank you Sergey. I will persue your suggestions.
KevinBrady57
20-Nov-12 17:20pm
View
I posted the code snippet used as an Improved Question. See above
KevinBrady57
19-Nov-12 10:51am
View
Posted.
KevinBrady57
18-Nov-12 12:13pm
View
No response?
KevinBrady57
7-Nov-12 11:03am
View
For the first question, I am creating an installation front end for my application. I will need to map a drive letter on the users machine to an internet location.
For the second question, I want to be able to verify that the drive letter is mapped to the correct location.
KevinBrady57
31-Oct-12 17:49pm
View
Thank you. I will read about this and experiment with it. I was not familiar with reflection before.
KevinBrady57
31-Oct-12 16:16pm
View
Why is it a bad idea to use VBFixedStringAttribute? You don;t explain why. This is done so I can read from a random access data file. What is the alternative?
KevinBrady57
23-Oct-12 19:29pm
View
Marshalling seems to be the way to do what I want to. I am still experimenting with it. I will let you know.
KevinBrady57
23-Oct-12 16:52pm
View
This small set of code was created to demonstrate and test the concept. I realize that the usefulness isn't self-evident. The full code set that I am attempting to implent this on is much, much larger and robust. Basically, I want to be able to pass a variable pointer to a class during (or just after) initialization of the class. It should be a pointer to a record structure field like "mRecord.Activity". I will be reading in all the records in the data file, one a at a time and checking the value of "mRecord.Activity" in the class. I don't want to have to keep passing the value of mRecord.Activity to the class. I want the class to use the value for the current record in that field. (The class actually operates on many of the data fields, that is why I don't want to have to pass them).
KevinBrady57
23-Oct-12 16:35pm
View
When I use the code from the article http://www.codeproject.com/Articles/712/How-to-do-pointers-in-Visual-Basic?msg=1633443#xx1633443xx the debugging environment throws an exception "PInvokeStackImbalance was detected Message: A call to PInvoke function 'Test1!WindowsApplication1.Form1::HeapAlloc' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature." I'm not sure what this means, but apparently, VB.NET or the environment doesn't want you to mess with the heap.
KevinBrady57
23-Oct-12 15:21pm
View
The second article is the way I remember doing it in VB6. This is still available in VB.NET? I thought (or was hoping) there was a more straightforward way of doing this in VB.NET.
KevinBrady57
23-Oct-12 14:32pm
View
Maciej, Thanks for your response. In the code you provide, you are resubmitting the variable to the class after changing it's value. jObj = CType(299.23, Object)
and testClass.myObBject = jObj. That is exactly what I do not want to do. I want to be able to change the value of the variable at the module level and have this be reflected in the class so when I call the value from the class it has the current value, not the original value. In other words, I want the variable in the class to be a pointer to the variable, not the variable value. How is this accomplished in VB.Net?
KevinBrady57
23-Oct-12 14:03pm
View
The return from the class is CType(TestCL.GetItem, Short) in the message box statement. The GetItem function in the class returns the value of the mItem class variable. GetItem is a function, not a sub.
KevinBrady57
23-Oct-12 13:34pm
View
First, I did explain what I thought should happen. The value returned by the class does not change when the variable is changed. How should I assign a value to jObj to avoid what you are presenting? Please provide a code snippet for the assignements of jObj.
KevinBrady57
23-Oct-12 12:48pm
View
I posted a new question titled "Understanding of Reference Variables - Part 2"
KevinBrady57
23-Oct-12 12:18pm
View
I will generate a new Question with the same title and "Part 2" ammended to the name.
KevinBrady57
23-Oct-12 1:31am
View
I found this article on boxing & unboxing for VB: http://msdn.microsoft.com/en-us/magazine/cc188935.aspx
KevinBrady57
23-Oct-12 0:10am
View
The reading I did indicated that this should work. I thought "does not work" was fairly obvious. When you change the value of the variable v1 (in the first test) the second reporting of the value from the data class does not get the change - it stills has the value of "100". I believe that the value returned by the class should be "299" since the variable was passed to the class as a reference (ByRef). I did execute it in the debugger. I didn't see anything that would help me to better undertand this behavior.
KevinBrady57
18-Oct-12 19:30pm
View
Ok. I am still on the learning curve for OOP programming. I was trying to have a generic base class to access the datafile and do some basic methods to limit the amount of coding needed.
KevinBrady57
18-Oct-12 17:15pm
View
I put the structure in the main module (renamed to "ProductUnitRecordType") and declased it public. I also declared the "Index" field as public within the
structure. I changed the inherit in the child class to "Inherits CNew_DataFile(Of ProductUnitRecordType)". The base class still cannot access the record fields, specifically the "Index" field. ???
KevinBrady57
18-Oct-12 16:56pm
View
Ok. I understand. Please understand that this program has about 40 or so different structures. I wanted to keep the data structure for each class with the class itself for ease-of-maintenance reasons. Now I ahve to pur them in a module. Any other way to do this?
KevinBrady57
18-Oct-12 16:24pm
View
Please explain your BTW comment further.
KevinBrady57
18-Oct-12 16:23pm
View
I did. I've tested it (opening a data file and reading a record) and it seems to work fine. However, the parent class cannot access the structure members like "jRecord.Index".
KevinBrady57
18-Oct-12 14:17pm
View
Thank you. Can I declare it Public inside the CTest_ProdUnit class?
KevinBrady57
15-Oct-12 23:59pm
View
I found the problem. I was running the code fragment from the Visual Studio environment. Visual Studio is credentialed to "SYSTEM" not to my user profile. After I created the exe and installed it, the copy file function works correctly.
KevinBrady57
14-Oct-12 12:38pm
View
It doesn't matter what mapped drive letter I use, the results and the error message are the same. I have attempted to use the destination drive letter while at work with a hard wire connection to a local network filer location. If I use the mapped drive letter, I get the error. When I use the actual physical address of the filer location, the file copies okay and there is no error. I understand that you are having a difficult time accepting this information, but it is true in my environment. I have re-verified the exact syntax about 20 times since I first posted this thread. The fact that I can perform the copy activity manually in Windows Explore and not from .NET code tells me that there is something different about the way the .NET frame work is interpreting the command (vs what Windows is doing). BTW - you absolutley can map a drive letter to a web location. In my Windows setup, the "W" drive is mapped to "onlinefilefolder.com\dav\" which is the storage space we have at Go Daddy. Of course, after you create the mapping, Windows ask for the user name and password. I have also previously done this same thing in Windows XP, so this is not anything new. Do you know of a way to extract the physical location of a mapped drive from Windows?
KevinBrady57
13-Oct-12 22:59pm
View
See below solution.
KevinBrady57
13-Oct-12 15:44pm
View
In the response to Sergey I did. The exception that gets thrown is "Could not find part of the path".
The file is not locked and does not exist at the destination. As I said, I can successfully do it manually in WE or from the command prompt. I just can't do it from within the program.
KevinBrady57
13-Oct-12 14:39pm
View
The error I am getting is a 405 error (method not allowed) NOT a 403 error. The method I am calling for upload is "Put" I think the pathname is correct, otherwise I would get an error message indicating that the web site could not be found. I am able to manually copy a file to that location using Windows Explorer or from the command line, so I do have write permission to the location. I just can't do it from the program in the Visual Studio environment. There are parameters for the HttpWebRequest method that I am unsure of. If you can provide assistance on these it would be appreiated. Should I specify a port? AllowWriteStreamBuffering = True Is this correct? SendChunked = True Is this correct? Headers.Add("Translate: f") Is this Correct?
KevinBrady57
13-Oct-12 14:24pm
View
There is not a problem in the code and I do have permission to write to the location. I can manually copy the file from the source to the destination in Windows Explorer or from the command propmpt. Also, I can copy a file if I use the absolute pathname to the destination. It just does not work when I use the drive letter.
KevinBrady57
12-Oct-12 13:55pm
View
I tried using System.IO.File.Copy(src, dst, True). Below is the exact code fragment that I was running:
Dim src As String = "C:\test\contactor.xls"
Dim dst As String = "M:\test\contactor.xls"
Try
System.IO.File.Copy(src, dst, True)
Catch ex As Exception
MessageBox.Show("An error occurred while attempting to copy the file" & vbCrLf & _
"The following error was thrown:" & vbCrLf & ex.Message)
End Try
The error message that is thron says "Could not find part of the path 'M:\test\contactor.xls"
I ran this from within the Visual Studio environment in debug mode. My Visual Studion environment is set-up to "Run as Administrator". My OS is Windows 7.
KevinBrady57
12-Oct-12 13:05pm
View
Thank you for the quick response.
Do you know anything about the 405 error?
KevinBrady57
11-Oct-12 12:13pm
View
There is a VB2010 set of code in CodeProject: http://www.codeproject.com/Articles/36444/How-to-Upload-a-File-to-a-WebDAV-Server-in-VB-NET
KevinBrady57
9-Oct-12 20:07pm
View
Isn't there some code snippet that will allow me to access the internet storage location that I can embed in my program?
KevinBrady57
9-Oct-12 19:33pm
View
Sorry. VB2010 on Windows 7.
KevinBrady57
9-Oct-12 18:59pm
View
Stuart, thanks very much for the quick response. Can you please provide an example of using the above for filestream read and write events.
I would have thought that unicode support would have been "built-in" to .NET?
KevinBrady57
9-Oct-12 17:49pm
View
Yes, I am using the old VB6 FileGet and FilePut. The .ney version of the program that I am currenyly working on was converted to VB2010 from VB6. It is a pretty large, class based program with 15 different modules.
I tried to use filestream methods when I converted all my programming efforts to VB.Net earlier this year. The problem that I encountered was that I could not get it to correctly read & write unicode characters, like ß (eszet in German). If you could tell me how to use uncode characters with filestream methods, that would be great.
KevinBrady57
5-Oct-12 17:31pm
View
What do you mean by "omit FileNumbers"? I don;t understand.
KevinBrady57
2-Sep-12 13:12pm
View
Philip, thank you for the quick response. The suggestion will work for me.
Show More