Asp.net - Converting New With From C# To .NET - Compilation Error
Dec 19, 2011
I have the following code in C#:
public static ArrayList GetGenders()
{
return new ArrayList()
{
new { Value = 1, Display = "ap" },
new { Value = 2, Display = "up" }
[Code]...
View 3 Replies
ADVERTISEMENT
Oct 12, 2010
I had a code for getting the hdd id written in vb.netNow I need to re-write the code into c#. I have converted the vb.net code to c# but it is not compiling.Below is the vb.net code
Dim hdCollection As ArrayList = New ArrayList()
Dim searcher As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive")
[code].....
View 4 Replies
Aug 5, 2009
I have a problem with the VB.NET compiler failing to compile a class (in a separate C# assembly) which contains two overloads of a method with generic arguments. The equivalent code in C# compiles against the same assembly with no errors. Here are the two method signatures:
protected void SetValue<T>(T newValue, ref T oldValue)
protected void SetValue<T>(T? newValue, ref T? oldValue) where T : struct
Here is the code to three assemblies that demonstrate the problem. The first is the C# assembly with a Base class that implements the generic methods. The second is a C# class derived from Base and calls both overloads of SetValue correctly. The third is a VB class also derived from Base, but fails to compile with the following error message:
[Code]...
Am I doing something wrong in the VB code, or are C# & VB different when it comes to generic overload resolution? If I make the method arguments in Base non-generic then everything compiles correctly, but then I have to implement SetValue for every type that I wish to support.
View 2 Replies
Dec 27, 2011
I'm running 64bits Windows 7 and using MS Visual Studio 2010. I'm doing a VB program connecting to mySQL database using 32bits ODBC connection. the program have no issues loading crystal report in Visual Studio IDE environment. However, after Build and install in the same machine the following error msg appeared when trying to load the crystal report with data call from database (ABLE
to display report when NO data call):
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
[Code].....
View 8 Replies
Apr 2, 2009
We were working with a VB.Net app that contains something like 2200 VB modules/forms/classes and got a not-uncommon error message when we went to compile it. (Didn't write down the exact message, but it's basically unable to copy an image file that's in use.)Problem, of course, is that not everybody got out of the app when we told them to. Like I said, not uncommon. (It's a shared app that runs from a server.)Now, the weird thing. After kicking the offenders out, when we recompiled the program the image, which we use on search buttons, was gone. The file was still there but all of the property settings that referenced it were gone. Looked into the Designer code & they were gone from there, too. Seems to me that a compiler should *mark* the code that won't compile, not delete it.Anyway, I only see two courses. Either we restore our app from a backup, losing all our changes, or we go thru all the forms (like I said, there are 2200 modules-not sure how many are forms, but it's a bunch) and manually replace the properties on all the search buttons. Either way it's going to cost us at least a day's work.
View 2 Replies
Apr 21, 2011
I am getting the following compilation errors from Microsoft Visual Basic 2010 Express on the first line of my code:
Error 1 Newline in constant C: cdotnetdevsrcvbmain estHelper.vb 1 1 Component Sources
Error 2 Too many characters in character literal C: cdotnetdevsrcvbmainRtestHelper.vb 1 1 Component Sources
The first line of my code is simply:
' Copyright 2011
It is generating the same compilation error for all my comments. Does anyone know why MS VB Express 2010 is acting this weird? Comments in visual basic are supposed to start with a single apostrophe so I don't understand this weird behavior.
View 1 Replies
Jul 25, 2011
I'm using access to replicate something that is very simple in excel. I have one "due date" column, and I want the cell right next to those cells to tell me if there are less than 15 days to that date. In excel is a simple conditional function, but I want to do it in Access because it looks better.I'm new to access and even though I've been reading some posts and forums I haven't been able to pull this out. I tried to program a macro with the following
Sub Alarma()
[Alarma] = IIf([Fecha de vencimiento] - 15 > Date(), " ", "Faltan menos de 15 d�as")
[code]....
It shows the following error -> Compilation error: External name not defined.
So, it's not reading the "Alarma" field... how do I define this field? It's inside a formulary, and Alarma is the title (I downloaded a template from the internet and changed the titles so I wouldn't have to do it from scratch...)
View 1 Replies
Feb 15, 2010
I keep getting this compilation error code 1 and when I click on swhow compiler detailed output, it shows the following:
[code]...
The aspnet user account has also vanished..
View 1 Replies
Oct 4, 2010
We have a Visual Basic Compilation Error at the web site located at [URL] Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
[Code]...
View 7 Replies
Jun 1, 2009
Quote:Value of type System.Nullable(Of Decimal) cannot be converted to System I have the code below which seems to work fine on my development server but causes a compilation error when I put it on my live webserver (uncommented).The error message I get from the event viewer in IIS is as above.
' <WebMethod(Description:="Insert into Referral Payments Table.")> _
'Public Function InsertReferralPayment(ByVal ReffererCustID As Integer, ByVal InstalledCustID As Integer, ByVal AmountReferrer As Nullable(Of Decimal), ByVal AmountInstalled As Nullable(Of Decimal), ByVal ReferrerChequeSentDate As Nullable(Of Date), ByVal InstalledChequeSentDate As Nullable(Of Date), ByVal ReferrerChequeNo As Integer, ByVal InstalledChequeNo As Integer, ByVal InputBy As String) As Integer
[code]....
From what I can tell IIS is configured the same and both referenced DataTables seem identical.
View 7 Replies
May 4, 2010
I have this code which populated my form;
Private Sub populateprojdetails()
Dim cmd As New SqlCommand
Dim conn As SqlConnection = GetDbConnection()[code]....
The Error I receive is "Error converting data type varchar to numeric".
View 1 Replies
Sep 21, 2011
I used the XSD.exe tool to convert XML to XSD then generate vb code behind for the XSD. It is giving me errors in the code even though it was auto-generated. I am weary about messing with the code since it was auto generated.
View 4 Replies
Sep 10, 2010
I have created a website in visual studio 2005 with some master pages. but whenm migrating to visual studio 2008 it is showing error (when I'm running the page) master page cannot be loaded.
View 3 Replies
Nov 12, 2011
read the COMPLETE email before giving me instructions.I say that because it seams like who ever is responding is only reading part of the email and responding.I have followed your instrutions and I still can not get myhello.vb to compile.
Both vbc.exe and mylello.vb is in the same folder c:program files
"C:Program Filesvbc.exe myhello.vb"
You stated that I should run command prompt as administrator and tye the same command as you do. what (as administrator) is. Please walk me through the complete process. Please do not tell me to run the command prompt as administrator because I do not know what that mean.I can not speak to my administrator. Also I attempting to compile a sample VB that came with the software, so using Visual Studio is not the solution.
View 5 Replies
Dec 20, 2010
I have a vb 6.0 file that compiles a CLS file in the same folder to a dll without the creation of any windows forms. Does anyone know of an example for this in VB.NET?
View 1 Replies
Apr 10, 2012
I converted a lot of code, and I had some errors in the conversion. There is one that I can't seem to figure it out[code]...
View 2 Replies
Jan 22, 2012
I'm using Visual Studio 2010 Pro on a Windows 7 PC, to build simple VB Windows Form Applications (I've just started learning VB). Lately when I try to debug my applications, it takes unusually long. For example, an application with just a blank form and nothing else will take about a minute to build, and then it will sit for another minute or two until the app window pops up. It didn't use to do this!
View 1 Replies
Jan 19, 2011
I have tried looking at "related" questions for answers to this but they don't seem to actually be related...Basically I have a VB.Net application with a catalogue,administration section (which can alter the catalogue, monitor page views etc etc) and other basic pages on the customer front end.When I compile and run the app on my local machine it seems to compile fairly quickly and run very fast. However when deployed on the server it seems to take forever and a day on the very first page load (no matter what page it is, how many stylesheets / JS files there are, how many images there are, how big the page markup is and so on). After this ALL the pages load really fast. My guess is this is due to having to load the code from scratch; after that, until it is recycled, the application runs perfectly fast. Does anyone have any idea how I could speed this part of the application up? I am afraid that some customers
View 1 Replies
Jun 10, 2011
i was used to be vb 6.0. but now im starting with vb 2010 because 6.0 is old. but now i have a few problems with converting some things for my game that im making.
in 6.0 it was
modPlayer (module)
Public Player(1 To MAX_PLAYERS) as PlayerRec
Private Type PlayerRec
Name as string
Level as string
End Type
but this code gives in 2010 some errors; it says it should be structures right now?
Module modPlayerRec
Public Player(0 To 100) As PlayerRec
Structure PlayerRec
Public Name As String
End Structure
End Module
what should be the right code for vb 2010? this is not working what i have right now.
View 5 Replies
Jan 27, 2010
I am playing around building a VB.net windows forms app.Mostly going well, but when I do executenonquery I am getting the error:Failed to convert parameter value from string to int32. I am unclear where the problem is but here is my code......
Private Sub cmdClockIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClockIn.Click
Dim empNum As Integer = Convert.ToInt32(frmMain.txtEmpID.Text)
[code]....
View 2 Replies
Feb 26, 2012
I used the following statement for a parameter.[code]...
View 1 Replies
Mar 11, 2009
using Visual Web Dev 2008 Express and i am having an error when converting a set of integers to string. see code below. I cannot work out what it is that i am typing incorrectly. For ref, i return ten 0's as the result.
Dim numbers(9) As Integer
For i As Integer = 0 To numbers.Length - 1
numbersString &= numbers(i).ToString & " "
Next
textbox2.text = numbersString
View 7 Replies
Jun 29, 2009
i have a textbix in which the user is restricted to enter date in the following format "dd/mm/yyyy" .
then in code behind I am calling a stored procedure to which i am passing this date as a datetime parameter but i get an error
objCmd.Parameters.Add("@DateOfApplication", SqlDbType.DateTime).Value = Convert.ToDateTime(txtDateOfApplication.Text.Trim)
how I might cast convert this string date into datetime to pass to my stored proc
View 13 Replies
Jul 8, 2010
how to convert this vb6 into vb net it has en error on addressof vb.net m_lngPreviousValue = SetWindowLong(p_lngWindowHandle, GWL_WNDPROC, AddressOf WindowProc)
View 2 Replies
May 18, 2010
I want to be able to determine if the web.config element
<compilation defaultLanguage="vb" debug="false" />
if the property is debug is set to true or false.
Public Shared Function isDebug() as Boolean
[code].....
View 1 Replies
Sep 21, 2011
I have a project in VB.NET 2010 (compiling to x86, .NET 2.0 runtime) that I want to compile into two separate EXEs - a "lite" version and a "full" version. Unfortunately I cannot make two separate projects as it uses the Adobe Reader COM control - and sharing a form using that control between two projects seems to confuse the IDE (something to do with COM Interop, I assume - if someone knows how to share a form hosting the adobe reader control, that would solve my problem too).
I have found this thread: C#: VS.NET: Change name of exe depending on conditional compilation symbol however I don't have any MSBuild experience so I need more explicit instructions. On the "My Project>Compile" tab there is a "Build Events..." button. I was wondering if anyone knows how to set a conditional compilation constant and use that to determine the EXE name (or change it after build). If all else fails I can rename the EXE manually I suppose, but I'd prefer it to be automated.
View 1 Replies
Nov 27, 2009
How can you write a #If statement on a single line?
vb.net
#Const Debug = True #If Debug Then Console.WriteLine("Debug")'I also tried:#If Debug Then : Console.WriteLine("Debug") : #End If'
But that didn't work either?
View 2 Replies
Feb 8, 2012
I've got a problem with a program that references a third party ActiveX component that I've been refused permission to distribute. The AX component is used on some user defined controls which the user can add programatically, which makes isolating them fairly easy. However, the problem is that if the program is installed on a machine without the third party component then it just crashes, where I would much prefer it to just alert the user to the missing component and then disable the functionality that requires the component.
In the past I've tried adding the reference programatically but have found that this solution doesn't work with this particular control.
View 1 Replies
Feb 3, 2010
Now days it is done in Resources.Designer.vb we have there following lines:
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
[code]...
View 3 Replies
Dec 25, 2009
In Debug mode my application compiles to a 4MB .msi file plus setup.exe at 368kb, and the installed app includes the .pdb file @ 2.3MB. If I change to Release mode I'd expect to avoid including the debug symbol file and considerably reduce the .msi size, but surprisingly the .msi goes up to 4.45MB and setup.exe to 420kb. Am I missing something here? I want to reduce the upload size of the application by avoiding the unnecessary debug file, but clearly I've misunderstood what's happening or maybe what I can do.
View 1 Replies