Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 25th, 2010, 11:51 AM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default i need help( convert c to vb.net)

i have a vb.net web,and i found in the internet a code that i need.
but the code is in c,can sombody here convert it to vb? i try many web conveting but they not good enough.

PHP Code:
attachment attachment = new attachment();

            
attachment.caption "www.icanhascheezburger.com";
            
attachment.name "I am bursting with joy";
            
attachment.href "http://icanhascheezburger.com/2009/04/22/funny-pictures-bursting-with-joy/";
            
attachment.description "a funny looking cat";
            
attachment.properties = new attachment_property()
            {
                
category = new attachment_category()
                {
                    
href "http://www.icanhascheezburger.com/category/humor",
                    
text "humor"
                
},
                
ratings "5 stars"
            
};
            
attachment.media = new List<attachment_media>(){new attachment_media_image()
                                    {
                                        
src "http://icanhascheezburger.files.wordpress.com/2009/03/funny-pictures-your-cat-is-bursting-with-joy1.jpg",
                                        
href "http://icanhascheezburger.com/2009/04/22/funny-pictures-bursting-with-joy/"
                                    
}}; 
 
Old October 25th, 2010, 01:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

HI there..

This look straighfoward to translate.. What are your problems with this code???

(it's not c, it's C#). Probably the online translator have problems because there are a lot of clases involved (that shouldn't be translated).
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old October 25th, 2010, 01:13 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Did you try: http://converter.telerik.com/ It should convert this just fine...

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old October 25th, 2010, 01:35 PM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default

i try it now and i got a error
http://img829.imageshack.us/img829/4630/aspk.jpg
how do i fix it ?
 
Old October 25th, 2010, 03:33 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Maybe this helps?

http://www.lmgtfy.com/?q=%22Name+of+...ith+%27.%27%22

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old October 25th, 2010, 07:31 PM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default

no,but thanks for trying.
 
Old October 26th, 2010, 02:25 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

It's a bit difficult to say for sure as your classes are unknown to me, but something like this should at least compile:

Code:
 
Dim attachment As New Attachment()
...
attachment.Caption = "www.icanhascheezburger.com"
attachment.media = New List(Of attachment_media) From { _
   New attachment_media() With { _
     .Src = "http://icanhascheezburger.files.word...-with-joy1.jpg", _
     .Href = "http://icanhascheezburger.com/2009/0...ting-with-joy/" _
   }
}
Notice how I changed attachment_media_image to attachment_media, as I doubt that the original code compiled (unless attachment_media_image inherits attachment_media).

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old October 26th, 2010, 06:26 AM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default

PHP Code:
  attachment.media = New List(Of attachment_media)()
                
With New attachment_media_image
                    
.type=attachment_media_type.image
                    
.src "http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs322.snc4/41570_161882717169966_2773595_n.jpg"
                    
.href "http://www.facebook.com/album.php?profile=1&id=1521763369#!/pages/nynt-tyyb-bsznh-lwhtt-18-l-mwmlz-lmy-smryz-wth/160559677301999"
                
End With 
this good?
 
Old October 26th, 2010, 01:07 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
this good?
If it compiles: yes. If it doesn't: no.

My guess is it doesn't as you haven't implemented my modifications such as From to initialize a collection, and the matching types in the generics list and the type you try to create.

But why don't you simplify this code? E.g.:

Code:
 
Dim myList As New List (Of Media_Attachment()
Dim att = New Media_Attachment()
att.src = "...."
.....
myList.Add(att)
Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old October 26th, 2010, 01:44 PM
Authorized User
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default

its not work,its run bot not good,my last script run too but not work.
its a application for thr facebook,i think i need a json code for that....





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert a vb.net line to C# Nishapd C# 2005 1 May 8th, 2009 12:45 PM
VB.NET 2003 Appendix B convert to VB 2008 Express Edition brucechess BOOK: Beginning VB.NET Databases 10 February 5th, 2009 12:52 PM
convert dsr file from vb to vb.net Shashi001 VB Components 1 September 22nd, 2006 12:24 PM
Syntax Help - Convert C# to VB.NET ank2go ASP.NET 1.0 and 1.1 Professional 3 July 7th, 2004 09:33 PM
Help - Convert from C# to VB.Net CrazyLegsCooper VS.NET 2002/2003 1 July 20th, 2003 10:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.