Nice one, I'm going to use that in an application I'm writing.
Thanks for sharing it with the group :)

Signature
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
> Thought the group might be interested in the following class(modified from
> an
[quoted text clipped - 51 lines]
>
> End Class
Dennis - 23 Oct 2004 16:45 GMT
You're welcome. Hope we have gracefully agreed to disagree on the spelling
issue...we all have our own opinions.
"One Handed Man ( OHM - Terry Burns )" wrote:
> Nice one, I'm going to use that in an application I'm writing.
>
[quoted text clipped - 55 lines]
> >
> > End Class
One Handed Man \( OHM - Terry Burns \) - 23 Oct 2004 18:06 GMT
I don't remember what spelling issues your talking about, unless your they
guy I had a big argument with about how important spelling was some two or
three months ago, in which case jus ignore me as I was simply being awkward
for the hell of it.
Cheers

Signature
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
> You're welcome. Hope we have gracefully agreed to disagree on the
> spelling
[quoted text clipped - 65 lines]
>> >
>> > End Class
Dennis - 23 Oct 2004 20:27 GMT
I'm the one...cheers.
"One Handed Man ( OHM - Terry Burns )" wrote:
> I don't remember what spelling issues your talking about, unless your they
> guy I had a big argument with about how important spelling was some two or
[quoted text clipped - 72 lines]
> >> >
> >> > End Class
> Thought the group might be interested in the following class(modified from an
> example I found on this newsgroup) for using embedded resources such as
[quoted text clipped - 7 lines]
> dim ic as icon
> ic = r.GetIcon("Icon1")
That's a good idea. Might I suggest a little improvemant may make it more
versatile. As you show, you have to create the resource before you can use it,
but it may be useful to use it in this manner:
Private bmp As Bitmap = MyResource.GetBitmap("mountains")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
Me.Icon = MyResource.GetIcon("Mountain.ico")
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles MyBase.Paint
e.Graphics.DrawImageUnscaled(bmp, 0, 0)
End Sub
Note the bmp variable is declared at the module level, where the resource class
could not be created.... To cover that usage, you could make those functions
shared also. Here is another go at that class with a few additions:
HTH
LFS
Public Class MyResource
Public Shared Function AssemblyName() As String
Return System.Reflection.Assembly.GetExecutingAssembly.GetName.Name
End Function
Public Shared Function GetIcon(ByVal Name As String) As System.Drawing.Icon
' *** NAME is CASE SENSITIVE ***
If Name.Length > 0 Then
Dim Filename As String
If InStr(LCase(Name), ".ico") > 0 Then
Filename = Name
Else
Filename = Name & ".ico"
End If
Dim res As System.IO.Stream = [Assembly].GetExecutingAssembly.GetManifestResourceStream( _
AssemblyName() & "." & Filename)
If Not res Is Nothing Then
GetIcon = New Icon(res)
res.Close()
End If
End If
End Function
Public Shared Function GetBitmap(ByVal Name As String) As System.Drawing.Bitmap
' *** NAME is CASE SENSITIVE ***
If Name.Length > 0 Then
Dim Filename As String
If InStr(LCase(Name), ".bmp") > 0 Then
Filename = Name
Else
Filename = Name & ".bmp"
End If
Dim res As System.IO.Stream = [Assembly].GetExecutingAssembly.GetManifestResourceStream( _
AssemblyName() & "." & Filename)
If Not res Is Nothing Then
GetBitmap = DirectCast(Bitmap.FromStream(res), Bitmap)
res.Close()
End If
End If
End Function
End Class
Dennis - 23 Oct 2004 20:35 GMT
Thanks...that does make it easier to use. I'm just not a very experienced
programmer (just a hobbiest and not much time to devote to it).
> > Thought the group might be interested in the following class(modified from an
> > example I found on this newsgroup) for using embedded resources such as
[quoted text clipped - 75 lines]
>
> End Class
Dennis - 23 Oct 2004 20:59 GMT
Larry, just one question. You noted that the name was case sensitive. Was
this only to determine if the name had the .ico or .bmp extension or does
that mean that the whole resource name is Case Sensitive, i.e., will
"icon1.ico" get a resource that was loaded named "ICON1.ICO"? Thanks again
for the tips.
> > Thought the group might be interested in the following class(modified from an
> > example I found on this newsgroup) for using embedded resources such as
[quoted text clipped - 75 lines]
>
> End Class
Larry Serflaten - 23 Oct 2004 22:19 GMT
"Dennis" <Dennis@discussions.microsoft.com> wrote
> Larry, just one question. You noted that the name was case sensitive. Was
> this only to determine if the name had the .ico or .bmp extension or does
> that mean that the whole resource name is Case Sensitive, i.e., will
> "icon1.ico" get a resource that was loaded named "ICON1.ICO"? Thanks again
> for the tips.
The name has to exactly match the name of the resource. In this case
'icon.ico' and 'ICON.ico' will not match and the method will fail. That's
why I thought it important to mention it right there in the methods....
LFS
Dennis - 23 Oct 2004 23:43 GMT
Yeah, I found that out by trial and error. However, the case of the
extension it seems needs to be in lower case.
> "Dennis" <Dennis@discussions.microsoft.com> wrote
> > Larry, just one question. You noted that the name was case sensitive. Was
[quoted text clipped - 8 lines]
>
> LFS