Welcome :Guest
Congratulations!!!

### Converting C# codes with "Delegate function" to VB.Net

Can someone help me converting this C sharp code to VB.Net? I tried to use several converters on google, none of them worked. /// <summary>     /// Returns the binary data of the image in the specifed format.     /// </summary>     /// <param name="format">The format of the bitmap image specified as "gif", "jpg", "png", "bmp", "jxr" or "tiff".</param>     public byte[] ToByteArray(string format)     {         //if image not altered return orig data         if (_data != null)             return _data;         //placed in a thread set to STA to overcome 0xC0000005 thrown in encoder.Save         if (!String.IsNullOrEmpty(Copyright))         {             byte[] data = null;             System.Threading.Thread worker = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(delegate (object obj) {                 BitmapEncoder encoder = GetEncoder(format);                 try &

### Converting the asm codes to support x64 bit machines

I am new to visual c++. I am using a  driver developed in Visual C++ , for my application which is being developed  in c#.

The drier works well with 32 bit machines and when i am trying to build for x64 bit it fails , because the drivers coding contains __asm codes which is not supported in x64bit .

The asm codes used are as follow,

First Set of codes:

__asm mov    edx, hi  \
__asm mov    eax,lo  \
__asm div    d32        \
__asm mov    q32, eax   \
__asm mov    r32, edx

where hi,lo are 64 bit data and d32,q32,r32 are 32 bit data

Second Set of Code:

__asm shr    hi, 1
__asm rcr   lo, 1

where hi,lo are 64 bit data

Third Set of Code:

__asm mov           ecx, FacsPtr
&nb

### WebMatrix conversion failed when converting from a character string to uniqueidentifier?

I am trying to retrieve xml from a small function in my .cshtml page. Its throwing me an error. This however, runs fine in a console/form environment.

It takes 3 parameters and 1 exception.

myDll.GetXML(year, username, uniqueidentifier, out ex);

When I run this page I get the error, "Conversion failed when converting from a character string to uniqueidentifier."

Or a stack of.

System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting from a character string to uniqueidentifier.

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBeha

### Writing codes using three tier architecture.

Hello all.

I am a beginner in c#.I heard that writing program with three tier architecture are easy and maintainable.

I just wanted to know with a small example on how to write three tier architecture programs.

Thanks :-)

### Converting ReportDocument object into byte array ?

Hi All,

Is it possible to convert the Report Document object as a byte array and store it in SQL , later retrieve and assing it to a report ?

### Problems converting VS 2003 project to VS 2008

Hi!

I'm having problems converting a VS 2003 project to VS 2008 (tried 2005 as well, same problem). There are several problems;
a) I don't have VS 2003 installed.
b) The project is a web service, however I'm not sure what type of VS project it was created as.
c) The general knowledge about the project setup is..slim.

I get a error message using the conversion wizard, however, I'm not familiar with the tool and I cannot quite find any good information on Google for it, so I am left with a error message I do not understand.

Conversion Issues - myProject.csproj:
Unable to open the Web site 'C:\local\path\to\project\myProject.csproj'. The Web site 'C:\local\path\to\project\myProject.csproj' does not exist.

The web service is not intended to run on the dev machine, it is copied to a test or a prod server. However, I do not know how this was done previously. I'm thinking that in order to convert, it has to access the server on which it should run (which is set somehow in a config maybe). But that doesn't actually make any sence..

If anyone could shed light on this, I would really appreciate it.

Thank you.

### Converting Time formats

Hi guys,

So ive been converting an asp website to asp.net. What i did was run the migration wizard in the old VS2003, then when importing it bk into vs2008, i belive it upgraded it agin. I have been plodding along correcting basic erros and have come stuck with this one. Originallany the site has two input types, one for date and one for time. the new script is below with error im getting. I manged to get the date correct but the time is more tricky. Any suggestions would be appreciated.

Date = FormatdateTime(IIF(IsDBNull(MyRs1.Fields.Item("").Value), Nothing, MyRs1.Fields.Item("").Value), DateFormat.ShortDate)

Time = FormatdateTime(IIF(IsDBNull(MyRs1.Fields.Item("").Value), Nothing, MyRs1.Fields.Item("").Value), DateFormat.ShortTime)

Exception Details: System.InvalidCastException: Conversion from type 'Double' to type 'Date' is not valid.

Source Error:

Line 74: Line 75: 'TODO Need to correct the format Line 76: Time= FormatDateTime(IIf(IsDBNull(MyRs1.Fields.Item("").Value), Nothing, MyR Help converting vbscript to vb.net   Can anyone help me convert the below vbscript to vb.net:   On Error Resume Next Dim sRunTime,sSitupCount,sPushupCount,sRunMin,sRunSec,sRunScore,sCompScore,sBodyCompDim iCompositeScore Set oRE = New RegExp sRunTime = InputBox("Enter your run time")oRE.Pattern = "[0-5][0-9]:[0-5][0-9]" If oRE.Test(sRunTime) = True Then WScript.Echo "Pattern Match"Else MsgBox "You must enter a valid run time in the following format: ""mm:ss""." & vbCr & "Please run the application again." WScript.Quit(Err.Number)End If sRunMin = Left(sRunTime,InStr(sRunTime,":")-1)sRunSec = Right(sRunTime,InStr(sRunTime,":")-1) sBodyComp = InputBox("Enter your waiste measurement")oRE.Pattern = "[2-6][0-9].[0,5]" If Len(sBodyComp) = 2 Then sBodyComp = sBodyComp + ".0"End If If oRE.Test(sBodyComp) = True Then WScript.Echo "Pattern Match"Else MsgBox "You must enter a waiste measurement in the following format: ""nn.n""." & vbCr & "Please run the application again." WScript.Quit(Err.Number)End If sSitupCount = InputBox Converting from PHP to ASP   Dear all friends  Hi to you all. I am now looking for not only your help but als your advices and suggestions to my situation.here is the url of my current running PHP server http://www.yarnxchange.com/index.phpFIrst things I wish to know is which asp controls can replace the current PHP ones to act the same way1.  In the top of the page the Latest news (News Ticker).2. Under the banner logo the black line has a streamer that read data from database and view them in sme way like marquee and when roll over it stops and when click i can go to the details page.3. In the bottom page The Yarn offers section . it shows data from mutiple tables but in the same place when click each item it displays the rows of its table in the right section . I think that there is a way or a data controller that can act the same way I wish your advice.For sure after that I wish to know your ideas , recommendations and advices to make the full conversion in the best way C# to VB: Converting to Boolean   I am converting some C# code to VB, the following code is part of a functionif (bool.Parse(v["Parent"].ToString())) { e.Row.CssClass = "Parent"; } V is System.Data.DataRowView When I convert this to. If Boolean.Parse(v("Parent").ToString()) Then e.Row.CssClass = "Parent" End If The code throws an error "String was not recognized as a valid Boolean" But if I use this code If CBool(v("Parent").ToString) = True Then e.Row.CssClass = "Parent" End If It works fine, which is great, I am just curious why? Converting Crystal Report 2005 to 2008 - Please Tell Me I'm Stupid :)   Hello peeps,   I have a series of Crystal Reports that I can view/edit using Visual Studio 2005 with no issues.  The method I'm using is to simply click on the *.rpt file and it opens in the VS crystal editor with no issues.  The problem I'm having is that we are upgrading to Visual Studio 2008, and when I open the *.rpt file in 2008 it opens as a binary file.  I guess I'm used to everything else in Visual Studio prompting me to convert the older version to the newer version, so I'm not sure what to do in this case.   Is this normal?  Is there an easy conversion method that I'm simply overlooking?  Am I screwed?  Who invented liquid soap, and why? Answers to any of these questions would be greatly appreciated... Error converting data type varchar to numeric.   I create a form to record data using ASP.NET and SQL database... when i run the project show error "Error converting data type varchar to numeric" what's the problem actually.i try to change in datatype in database.. but still showing error...Thanks problem when converting html to pdf using ItextSharp    hi all i have using itextsharp to convert html to pdf and its worked very good in english letters (A-Z) but when i trying to do it with arabic letters i have got empty pdf , can any one help me? what i should do ? Converting UTC to another Time... in XSLT SharePoint designer using ddwrt   I am not a programmer, nor do I know any coding languages.  I have a slightly above average understanding of how writing code works, so please keep that in mind when responding....  I am using a list in SharePoint; when the list is updated, I want to display "UPDATED w/ Date and Time".  I cannot figure out how to display the Local Afghanistan time vice UTC or Zulu time. I am trying to figure out what to add in to change the time displayed +4:30 hours.  I am currently using the following code in XSLT with SharePoint Designer: <xsl:if test="ddwrt:FormatDate(string(@Modified), number(1033), 1)=ddwrt:FormatDate(ddwrt:TodayIso(), number(1033), 1)">    <xsl:if test="ddwrt:FormatDate(string(@Modified), number(1033), 1)!=ddwrt:FormatDate(string(@Created), number(1033), 1)">    <Span style="background-color:maroon;color:white">UPDATED <xsl:value-of disable-output-escaping="no" select="@Modified" /></span>    </xsl:if> (/xsl:if> Converting Word Documents to PDF using SharePoint Server 2010 and Word Services (Visual How To)   Watch the video and explore code as you learn how to programmatically convert Word documents to PDF format on the server by using Word Automation Services with SharePoint Server 2010. Sample: Converting Word Documents to PDF using SharePoint Server 2010 and Word Automation Services   Explore the code in this visual how-to article as you learn how to programmatically convert Word documents to PDF format on the server by using Word Automation Services with SharePoint Server 2010. Video: Converting Word Documents to PDF Format Using SharePoint Server 2010 and Word Services   Watch this visual how-to video as you learn how to programmatically convert Word documents to PDF format on the server by using Word Automation Services with SharePoint Server 2010. (Length: 6:15)
 Categories:
 ASP.Net Windows Application .NET Framework C# VB.Net ADO.Net Sql Server SharePoint Silverlight Others All