|
A byte array can't be displayed as an image. Create a MemoryStream from the byte array, and load the image from the stream.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Can u give me sample to do memorystream?...really2 need help
|
|
|
|
|
I'm working on some code generation and I want to support VB.net as well as C#, just because I'm a nice guy.
I don't know VB.net (at all), so I just want to get confirmation or corrections on this attempt at a translation:
(Nevermind the format and fully-qualified names, that's just the way I roll.)
-- C# --
namespace Foo
{
partial class Bar
{
[System.FlagsAttribute()]
public enum Fizz : int
{
[System.ComponentModel.DescriptionAttribute("The sound a bee makes")]
Buzz = 0
}
}
}
-- VB --
Namespace Foo
Partial Class Bar
''' <summary>Just an enum</summary>
<System.FlagsAttribute()>
Public Enum Fizz As Integer
''' <summary>The sound a bee makes</summary>
<System.ComponentModel.DescriptionAttribute("The sound a bee makes")>
Buzz = 0
End Enum
End Class
End Namespace
Does this seem essentially correct? Have I made a horrendous mistake or perhaps a minor typographical error?
|
|
|
|
|
Hi PIEBALD,
if you create a code generator, it might be wise to present the output to an actual compiler,
rather than asking here on a forum. If you don't have VB.NET yet, there is the same Express
edition as for the other .NET languages, you can download it freely and be up and running in
a matter of minutes.
Maybe, not sure, maybe the VB.NET compiler itself is simply part of the .NET framework and
you could invoke it directly, no VS Express required.
Make sure to use the fully qualified path as in C:\Windows\Microsoft.NET\Framework\v2.0.50727\vbc.exe
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Yeah... I coooouuuld...
I was just hoping to get a thumb up or down before I progress to that point.
|
|
|
|
|
Always there to help:
BTW: does it work for more than one enum value too?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
correction:
1. mostly
2. however on all the < System....> stuff: they need a continuation marker ('_')
vbc is happy with:
Namespace Foo
''' < summary>
'''
''' < /summary>
''' < remarks>< /remarks>
Partial Class bar2
''' < summary>
'''
''' < /summary>
''' < remarks>< /remarks>
< System.FlagsAttribute()> _
Public Enum aha As Integer
aa = 0
''' < summary>
'''
''' < /summary>
< System.ComponentModel.DescriptionAttribute("The sound a bee makes")> _
bb = 1
End Enum
End Class
End Namespace
[spaces added after < against <> monster]
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: they need a continuation marker
Yep got that, but it took a few guesses. The compiler said it needed continuation, but not what character to use.
I haven't used BASIC for nearly twenty years, and that was VAX BASIC.
|
|
|
|
|
There is a thing called documentation, a great tool called Google, and a bunch of
very nice articles on CodeProject. You know that.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Yes, but I was using the wife's laptop, at Chuck E. Cheese; no Visual Studio, no Internet connection.
(I left the house after your first reply.)
I am better for having figured it out for myself.
|
|
|
|
|
PIEBALDconsult wrote: I am better for having figured it out for myself.
again.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Take a look at using the CodeDOM for your code generation needs. We use this in Diamond Binding for the (little) codegen we have to do. You build up the document programatically, and then ask CodeDOM to output it in a specific language.
|
|
|
|
|
I'm using XSLT, so I can produce CSV or just about anything else you might need, not just code.
I should have the article ready to submit this weekend. The XSLT for a VB enumeration was the last thing I wanted to write. (I'm not sure that came out right. )
But I'll take a look at CodeDOM.
|
|
|
|
|
I want to write a program by using Matlab software which can open a file as a notepad type that file not as text file type but could be open as like a notepad file
and i want revise it as the changing some values in the file that place in some lines & columns of that file and close the file and save it.
how i can do this procedure???!!! which command i should used????
thanks a lot;
|
|
|
|
|
Try calling the 'I need to find a Matlab forum instead of asking about it in a totally unrelated place' method.
afshing wrote: hich can open a file as a notepad type that file not as text file type but could be open as like a notepad file
This shows you have absolutely no idea what the hell you're talking about. Tell your teacher that you're lost, lonely and confused. They can either put you back into a more basic class, or recommend a change of course for you.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
And this has precisely what to do with VB.NET and the .NET Framework??
|
|
|
|
|
I was wondering if anyone out there in the world would have a script to accomplish the above. That being associate anything that is opened up with a .tiff or .tif extension is opened in the Microsoft Office Document Imaging application.
Thank you in advance for ANY and all help.
|
|
|
|
|
Hi,
I have a C DLL that I wrote using VS6 and a Visio Add-In DLL I wrote using VB6. I tested the C DLL by creating a VB6 test app and no problems but when using the same code in my VB6 Visio Add-In, the params to the C DLL gets garbage.
When debugging the VS6 C DLL I see the utfdata is correct and the fileID is correct but the datalength is always garbage value. When debugging the VB6 Visio Add-IN DLL I see the correct Utf8Size is being passed.
VS6 C DLL Function:
__declspec(dllexport) int __stdcall WriteUTF8Data(void *utfdata, int datalength, int fileID)
VB6 DLL
Public Declare Function WriteUTF8Data Lib "myutf" (UniLine As Any, ByVal utflen As Integer, ByVal FileID As Integer) As Integer
Public Function WriteUTF8Line(ByVal str As String, ByVal filenum As Integer) As Integer
Dim bytUtf8() As Byte
Dim Utf8Size As Integer
Dim current
' Get active directory
current = CurDir()
' To work, must set app path as active directory.
ChDir (App.Path)
bytUtf8 = StrConv(str, vbUnicode)
Utf8Size = UBound(bytUtf8) + 1
WriteUTF8Line = WriteUTF8Data(bytUtf8(0), Utf8Size, filenum)
' set back to active directory
ChDir (current)
End Function
Any help you can provide would be very appreciated.
Thanks!
<div class="ForumMod">modified on Tuesday, February 17, 2009 4:34 PM</div>
|
|
|
|
|
Found it
Changed VB6 Add-IN DLL Declare to:
Public Declare Function WriteUTF8Data Lib "myutf" (UniLine As Any, ByVal utflen As Long, ByVal FileID As Long) As Integer
|
|
|
|
|
I have an XML doc that contains some file info (path, date created, etc.) and some media files in a folder with the same properties. Trying to devise some sort of way to compare the two lists and return a list of files that are not already described in the XML doc has been quite a challenge.
First I get the files and their properties from the watched folder:
Dim mediaFiles = From file In fileinfo _
Where file.Extension = ".avi" Or file.Extension = ".mov" _
Or file.Extension = ".mkv" _
Or file.Extension = ".mp4" _
Or file.Extension = ".asf" _
Select file
Then the nodes from the XML doc that describe those files:
Dim showsInXML = From s In doc...<tvshow> _
Select s
After that I compare the two lists, to get the ones that are the same:
Dim mediaOnFileSystemAndInXML = From mf In mediaFiles, sh In showsInXML _
Where mf.FullName = sh.<path>.Value _
Select mf
So far, so good. But after that when I want to 'invert' my selection (get only the files that are on disc, but not described in XML) with the following:
Dim mediaOnFileSystemAndNotInXML = mediaFiles.Except(mediaOnFileSystemAndInXML)
...I get the same ones as in the mediaFiles . As far as I can tell, I'm telling Except to compare the same objects, so what gives?
|
|
|
|
|
hi,
I am working in vb.net 2005
i want to check is current time is lie between two times "t1" and "t2"
i want to check only time values not a complete date or with date.
for example
Current time= "06:21:18 PM"
t1="08:30:15 PM"
t2 ="02:10:05 AM"
WAITING FOR REPLY
|
|
|
|
|
Hi,
create DateTime instances of each of your strings (using DateTime.Parse or better yet TryParse),
then compare them with whatever comparison operator you choose (<, <=, >, ...)
FYI1: when year/month/day are absent their current values are used; that normally does not
interfere with delta calculations or comparisons. If you want to get rid of Y/M/D get
the TimeOfDay property (which returns a TimeSpan).
FYI2: TimeSpan could do this too (without any year/month/day) if you were to use 24-hour notation instead of AM/PM notation; AFAIK TimeSpan.Parse does not understand AM/PM.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
The MP3 player I'm working on needs to detect the volume level at certain points of an MP3 file. I'd like to do this programmatically by looking at the file itself, as opposed to going through the sound card while the song is playing. I want to set it up to start the next song when the volume drops to a certain level. Cross-fading is too arbitrary and clunky.
Can you point me in the direction I need to go to find this information? Thanks in advance.
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
You're going to need a library to process the MP3's to do this. I suggest Googling for something like ".net MP3 normalize" to see what the possibilities are. I don't know of any processing libraries myself, since I don't do any work with MP3's.
|
|
|
|
|
Can I insert a link as Linklabel in MsgBox. I want to click in MsgBox to open a site
|
|
|
|