|
First, you didn't specify which line the expection is thrown on. I'm not really up to guessing, but I can see a glaring problem.
In this code:
Dim TitleLink As HyperLink = CType(e.Item.FindControl("ProdTitleLink"), HyperLink)
Dim TextLink As HyperLink = CType(e.Item.FindControl("ProdTextLink"), HyperLink)
Dim prodID As HtmlInputHidden = CType(e.Item.FindControl("ProductID"), HtmlInputHidden)
you're assuming that the call to FindControl actually returns a control. If you're trying to use the TitleLink, TextLink, and prodID objects, and FindControl did NOT find the controls you THINK they did, you'll get the error you're talking about.
Check the return values/objects of methods before you attempt to use those values/objects. You might not get back what you think you should be getting.
|
|
|
|
|
There is no problem finding the TitleLink or the TextLink and to set the value for it.
It's only when I start looking for the HtmlInputHidden!!!
|
|
|
|
|
This question really belongs in the ASP.NET Forum. It has nothing to do with VB.NET.
Now, yo answer you're question. Find controls only works with ASP.NET server-side controls. It will NOT find an HTML control on the form, which is what you used. I have no idea if you can use an ASP.NET TextBox control and change it's state to Hidden. You'll have to ask in the ASP.NET forum or just experiment with it.
|
|
|
|
|
I am teaching my self VB.NET. I am also a webmaster for a church website. We upload all the sermons to the website every week, by hand. In order to automate that, I want to create an application that rip a cd and then upload the ripped audio file to the website and fill in the provided information into a mysql database.
I have figured out the database part, and I have also figured out mainly how to convert from a wave file to an mp3 using lame. However, I have not found any tutorials in VB.NET that allow access to the cd-rom drive, or ripping the audio from the cd for that matter.
So my question is:
Is it possible to rip a cd using vb.net? Does anyone know of any tutorials to guide me on my way?
|
|
|
|
|
|
one problem, its in c++ not vb.net
I have found plenty of examples in c++, but not in vb.net. I am wondering if there is a library that I will need to include to obtain what I want. (I am using VB 2005 Express Edition (.NET))
|
|
|
|
|
I am currently looking at the Windows Media Player Library (WMPLib). It is fine if it requires Windows Media Player, so I am not worried about that. It looks hopeful.
|
|
|
|
|
I have made some of that, but i am still having a problem setting options when ripping to come out other than wma file, anyone knows how to do that?
try to use the windows media 10 SDK, you can also have a sample media player using vb.net from that...
have a nice day...
ianbacalla
|
|
|
|
|
I have just run into the same problem as you. I'll let you know when I find out.
I was also wondering if you knew how to choose which tracks are being ripped, and where the destination directory/file names are.
Here is my code:
<br />
Dim cdromcollection As WMPLib.IWMPCdromCollection<br />
Dim mediaplayercore As New WMPLib.WindowsMediaPlayerClass<br />
Dim cdrom As WMPLib.IWMPCdrom<br />
Dim rip As WMPLib.IWMPCdromRip<br />
<br />
cdromcollection = mediaplayercore.cdromCollection<br />
cdrom = cdromcollection.getByDriveSpecifier(My.Settings.cd)<br />
Dim media As WMPLib.IWMPMedia<br />
media = cdrom.Playlist.Item(My.Settings.track)<br />
Dim Playlist As WMPLib.IWMPPlaylist = mediaplayercore.newPlaylist("templist", "")<br />
Playlist.clear()<br />
Playlist.appendItem(media)<br />
rip = cdrom<br />
rip.startRip()<br />
|
|
|
|
|
Cool, ok let me know if you found one, i'll let you know too...thanks...
here is my code for selecting a file to rip :
dim m as wmplib.iwmpcdrom<br />
<br />
For x As Integer = 0 To mMediaPlaylist.count - 1<br />
If lst.Item(i).ToString().ToUpper() = mMediaPlaylist.Item(x).getItemInfo("Title").ToUpper() Then<br />
m = MediaPlayer.cdromCollection.getByDriveSpecifier(mReadyDrive)<br />
m.Playlist.Item(x).setItemInfo("SelectedForRip", CType(True, String))<br />
End If<br />
Next
I did not come up with the destination of the tracks because i just wanted it to be in mymusic folder...but is is better to have that.
Have a good day...
ianbacalla
|
|
|
|
|
see my other reply about 9 1/2 hours before your last reply. It has a good link to a complete source code for this. It doesn't use windows media player at all. The website is in German though, and so are the comments in the source code as well as the program itself, but the code is pretty easy to understand.
|
|
|
|
|
Hi,
Did anybody found how to get/set the ripped folder ?
doğu tümerdem
|
|
|
|
|
I found this source code, and it compiles and works!
http://actorics.de/rm_code/cdrip.htm
The only thing is the web page is in German, but hey code is code
|
|
|
|
|
wow....this is good, thanks.... . but i have encountered an error when ripping track to MP3 file format. I have encountered this last time, but i haven't found any solution yet. does ripping to MP3 works fine for you? it has a problem loading lame_enc_vb.dll for me.
but thank you, this really help.
|
|
|
|
|
Yes I had that problem to. Copy the dlls from the dlls folder to the bin/debug folder. I haven't tried to publish the program yet, but there should be a way to make sure it is placed in the correct directory when the program is installed.
|
|
|
|
|
I am trying to take an array of Hex strings and convert them to an array of (hex)bytes.
I can't do this:
arrayByte() = arrayStr()
I can't do this:
arrayByte() = convert.hex(arrayStr())
I can't do this:
arrayByte() = conversion.tobyte(arrayStr())
Does anyone know how I can do this? The trouble is when I try to convert a Hex string like e9 to a byte.
|
|
|
|
|
Hi Cory,
the following line of code converts one string to one byte, expecting a hexadecimal
representation of the byte's value:
byte.Parse("e9", NumberStyles.AllowHexSpecifier)
it would throw an exception on bad input; the alternative TryParse() would not.
if your string contains more data, you would have to split it (using either String.Split
or String.Substring).
if you have an array of strings each representing one byte, and want an array of bytes,
you would have to create a byte array (with same dimension as the string array), then
loop over each array element.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Please look at my code. When I send a string str ="4003" in function I am not getting Hex byte.
The Do While will grab each char in the string array. When "4" goes through it is converted to a Hexidecimal string. When I try your suggested code bytes(i) = Byte.Parse(sValue, Globalization.NumberStyles.AllowHexSpecifier) sValue is equal to "34" it converts from the Hexidecimal string to a Decimal byte.
Do While str.Length > 0
'first I take each character using substring
sValue = str.Substring(0, 1).ToString()
'then convert character into ascii.
sValue = Strings.Asc(sValue)
'then convert ascii value into Hex Format
sValue = Conversion.Hex(sValue)
'after converting remove the character.
sHex(count) = sValue
bytes(i) = Byte.Parse(sValue, Globalization.NumberStyles.AllowHexSpecifier)
count = count + 1
str = str.Substring(1, str.Length - 1)
i = i + 1
What am I doing wrong.
Thanks for your help.
|
|
|
|
|
Hi,
you are still confusing everything: hexadecimal, ASCII, char and byte.
Tell me what you want in examples, not words (you mix them up),
and not code (since I assume you ask because it does not do what you want).
From the examples I'll try to put it in correct words and maybe code too.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
EX1:
4003
turn into
byte() of Hexidecimals {34, 30, 30, 33}
EX2:
Changed
turn into
byte() of Hexidecimals{63,68,61,6E,67,65,64}
|
|
|
|
|
OK, I think that would be
"how to convert a string to a byte array containing the ASCII values of the
string's characters"
unless the string also might contain non-ASCII characters, in which case additional
specifications would be required.
So there is no string array, and actually there is nothing hexadecimal at all.
A byte is a byte, hexadecimal is just a way of looking at the content of the byte.
That is: the character '1' in ASCII is coded as a byte with decimal value 49,
hexadecimal value 31, binary value 00110001, octal value 061, that's all the same byte.
The job is handled by the following line of C# code:
byte[] AsciiByteArray=Encoding.ASCII.GetBytes(myInputString);
Since all Framework classes are available to VB.NET too, I trust you will know
how to do the same in one line of VB.NET
BTW: if the input is not ASCII but some other encoding, chances are that encoding
is also available in .NET and just requires a minor modification of the code.
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I’m using vb.net 2005 on vista32.
WMI Class "CIMV2\Win32_VideoSettings" does not work under Vista.
Do you know an other possibility?
Sven.
|
|
|
|
|
Looking for an OS-specific list is pointless. What if you have two screens on two different graphics adapters? The supported resolutions is a property of the graphics adapter, not the OS, so I'd suggest you look in the WMI classes for the graphics adapters.
|
|
|
|
|
Great Idea,
What class exactly do you mean ?
I couldn’t found any....
|
|
|
|
|
Hi,
are you saying you have WMI code that runs on XP but not on Vista ?
If so, you may want to try good old Win32 functions such as EnumDisplaySettings in user32.dll
although I don't know how that behaves on Vista.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|