Get A NullReferenceException In The Following Scenario?
Jun 8, 2010
How can I get a NullReferenceException in the following scenario?
Dim langs As IEnumerable(Of SomeCustomObject) = //some LINQ query
If langs Is Nothing Then Return Nothing
If langs.Count = 1 Then //NullReferenceException here
What am I missing here? Debug shows that langs is really just a LINQ queryresult without any results...
View 3 Replies
ADVERTISEMENT
Mar 6, 2011
I should start a project where several clients are included. There is a wcf web service controler that after a call from an specific client about a certain question it will retrive data from a server in London and then it will pass it back to the corresponding client in a different country e.g.
Clients and service are far away. the only way of transportation is through HTTP and intenet connection. Service should be able to callback also so i guess it will be dualHttpBinding.
View 2 Replies
Apr 11, 2010
I'm working on a system where there can be 2 level of users "Admin" or "Researcher".We have the requirement to allow the researcher to change fields for a record a record, but they want the original values to stay in the record and have an admin "accept" or "approve" the changes before the real record gets updated.Has anyone run into this scenario before? I'm trying to think of the best way to do this.
View 3 Replies
Jul 21, 2011
If we have an input text file such as:
ac 5
as 3
bc 5
[code].....
and in the given situation i dont need "bad data line", what would the codes be to remove it?
View 3 Replies
Apr 21, 2010
I have a class exercise that I need to do by next week. The problem is that I don't know how to write it.What I have to do is write pseudocode/algorithm for a scenario.I understand that I need to use a 5 step process for it but I don't know how to turn it into pseudocode.This is the scenario (there are 3 from memory that I need to do this is just one)"you want to estimate the number of hours it will take you to complete all of the levels in a new video game based on your past perfomance with other games."
I know I need to break it down into inputs, outputs and processes? I think that's right, but I'm struggling with writing it and getting it started.I don't need to use any actual code for the exercise. I just have to do the pseudocode and a flow chart for each scenario.
View 6 Replies
Aug 24, 2011
In the following subroutine, will the StreamReader be closed properly when the exception is thrown? Or do I have do something myself to ensure this?
[Code]...
View 2 Replies
Dec 23, 2009
I've got a problem losing session variables in an ASP/VB.NET application. The application allows searching for an item or it can show an item if provided with a unique link (in the browser). It holds information about the item in session variables. In the webpage showing an Item a user can click a button which opens a window with additional information about the item - obtained from a session variable. When I search for the item using the search engine and click the button - it works OK.
When I copy the link to a browser: the item is shown, however clicking the button returns a 'null exception' - the session variables with information about the item are lost. Moreover when I provide the link for the second time the button works, the variables are there!
View 1 Replies
Aug 13, 2011
I have an application that I'm writing that needs to allow the user to be able to create templates and save them for how the applicaton will work. For instance, lets say I am provisioining mobile devices, and my application allows the user to create a template to only install "application1" on the device, with "application1" settings for "devicetype1". But then if the user has "devicetype2", he or she can select the template that they created to install the software for that kind of device. I've looked around and all I find is the .exe.config for read only application settings, and I have found the user.config for the read/write variables. But that won't work as my application could have several templates depending on what the user chooses. I'm looking to have my app have a "create template", "edit existing template, and"use existing template" buttons, and have my config file extension like *.ipx for example.
View 1 Replies
May 10, 2010
I created a function that creates a global temporary table to stage data from a excel sheet I need the table to persist for me to map the columns using a form. The table is still there when the code goes back to the sub that calls the function until I call the form where I do the mapping. I am trying to avoid create/drop table scenario with a perm stage table.How can I get this table to persist until the data gets loaded into the perm table?
View 8 Replies
Oct 21, 2010
I am getting a NullReferenceException was unhandled error when i run my debugging in this part of my code:Dim x As Integer = Val(index.Chars(0))
View 7 Replies
Mar 19, 2009
I'm a little baffled why I get this error. Scenario: Printing - 6 different things to print including "Permit" and "Permit Copies". "Permit" looks like a drivers license including a photo."Permit Copies" is exactly the same except it has a piece of text at the bottom that says "Sheriffs Copy".
The problem is when trying to print "Permit Copies". Very few of them shows the print preview - most just display the FileNotFoundException error. If "Permit" pulls up the photo just fine, why not "Permit Copies?" It should be trying to pull up the same photo as "Permit" - same file path/name. Where is it wrong in my code?
[Code]...
View 3 Replies
Sep 19, 2011
This never happened to me, and the less data one has (usually) the less you can say what happened.I am trying to write a simple query analyser. I randomly receive these kind of crashes:
[Code]...
The file specified above does not exist. The place where it crashes is wrapped with Try-End Try. Moreover, yes, I have the painting event set up but it should not concern it (or maybe it does?). I have to add that I use visual basic express edition. The error occurs ocasionally - sometimes when I'm lucky nothing happens, and when I'm not then I get this crash.
View 1 Replies
Apr 5, 2011
When I debug a program my IDE simply does not catch System.NullReferenceException - execution continues as if there were nothing wrong.Moreover, when I go to the menu Debug/Exceptions System.NullReferenceException is not even in the list(Common Language Runtime Exceptions).
I manually add it (there is the Add button) and I put a checkmark in the 'Thrown' and 'User unhandled' column - now IDE catches it, but after I re-load the project the situation re-appears - and NullReferenceException is not on the list again. What may be wrong?
Update:No, when I step through the code the execution does not continue but exits the current block of code (sub or function). There were no Try...Catch blocks and there is a message: A System.NullReferenceException occured in MSCorlib.dll... But why doesn't the debugger stop at this line?
View 3 Replies
Nov 21, 2009
Okay after searching two listbox's on a form I am trying to put a number as a string in a label setup for that but keep exgetting a NullReferenceexception error on the label. Label being "shippingDataLabel.text".e is my code;
Public Class MainForm
Dim fifteenShipping As Integer = 15
Dim twentyShipping As Integer = 20
[code].....
View 2 Replies
Jul 25, 2011
I have a VB.NET solution that I just upgraded. It was originally in .NET 1.1, I upgraded to .NET 2.0 and verified that it would build and run correctly. Then I upgraded from 2.0 to 4.0. It is still building with no errors, but when I try to run I am getting a NullReferenceException in Global.asax.vb. The really weird thing is, the line that is throwing the exception is this:
Dim dt As System.Data.DataTable I am not trying to use the variable, just declare it. Further down a Function is called that returns a DataTable and sets the variable, but I don't even get to that line. It is throwing the NullReferenceException on the Dim line. Has anyone run across this before? Is this some issue with upgrading?
[Code]...
I did a Rebuild Solution before posting. This is a web application and the only files I see in the bin folder are the dll files I am referencing. I'm not sure what else I should clean up.
View 1 Replies
Mar 16, 2009
I've seen so many posts on this but I just don't understand how to fix it.
HTML
Me.txtDeletedItem.Text = objDeleteLog.Name
[b]Me.txtDeleteReason.Text = objDeleteLog.Code.Description[/b]
[code]....
View 2 Replies
Jan 25, 2012
vb
Imports System.Windows.Forms.HtmlDocument
Public Class test_vbdotnet
Private Sub runtime()
[Code].....
I want VB.NET to get access to the innerText and make a if statement out of it. But it always returns error. (see the comments for details.)
View 3 Replies
Nov 30, 2010
This is driving me slighty madder than i usually am. The thing thats bugging me is the EXACT same code works in a test project i did with an sdf database.See my comments in the code
vb Private Sub tbScan_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tbScan.KeyUp
[Code]...
View 5 Replies
May 7, 2011
VB
Dimserial As New Processserial.StartInfo.FileName = "adb"serial.StartInfo.Arguments = "get-serialno"serial.StartInfo.UseShellExecute = Falseserial.StartInfo.RedirectStandardOutput =
[code].....
View 6 Replies
Feb 24, 2010
I've got a little problem here:
Code:
Dim DirInfo As IO.DirectoryInfo = Nothing
... some code ...
Me.Tag = DirInfo.FullName
In this code, DirInfo.FullName is sometimes null. So I put this code inside a Try Catch. Although it works fine but I see a System.NullReferenceException in Immediate Windows. I just want to prevent it.
So tried:
If DirInfo.FullName IsNot Nothing Then Me.Tag = DirInfo.FullName
If DirInfo.FullName <> Nothing Then Me.Tag = DirInfo.FullName
If DirInfo.FullName <> "" Then Me.Tag = DirInfo.FullName
But I still get this System.NullReferenceException! How should I check DirInfo.FullName so I prevent this exception?
View 2 Replies
May 12, 2009
I keep getting a NullReferenceException error on this UNZIP code:
Dim Sh As New Shell
Dim SF As Folder = Sh.NameSpace("C:\test.zip")
Dim DF As Folder = Sh.NameSpace("C:\test")
[Code]....
i checked to see if i had a test.zip file in my root dir...its there... i have shell32 referenced
View 1 Replies
Jul 21, 2011
I am trying to flatten a multi-dimensional array with ConvertAll but I can't get it to work:
Private Function Flatten(ByRef a As Object) As Object
Dim elements As Integer = 0
Dim size As Integer[code]...
Why does it throw NullReferenceException?
View 1 Replies
May 18, 2009
The following code causes a NullReferenceException
tStartParameter = String.Format(tStartParameter, tTo, tSubject)
tProcess = Process.Start(New ProcessStartInfo(tStartParameter) _
With {.UseShellExecute = True})
tProcess.WaitForExit()
[Code]....
causes this exception:
InvalidOperationException: No process is associated with this object.
View 1 Replies
May 22, 2012
I have the following code:
Dim getProspect = (From p In dbContext.IRF_Prospects _
Where p.url = prospect_url _
Select p).FirstOrDefault
[Code]....
When I execute it, it throws an object reference not set to an instance of an object error on getProspect.user_id. Why is it doing this? Shouldn't the fact that I'm verifying it exists using IsDBNull first keep this from happening?
View 1 Replies
Oct 28, 2010
As a test, my boss asked me to convert a (not very critical) ASP.NET site from 1.1 to 4.0. Well, it's not extremely difficult and things are going well so far. However, I've hit a small snag. I keep getting a NullReferenceException when I run this code:
Public Property PageTitle() As String
'===========================================================================
'Exposes the PageTitle property of the child control.
[Code]......
View 1 Replies
Nov 12, 2010
We have a property whose job is to look up a description. If the lookup fails it should show an empty string.
So we can code the property like this:
If foo.bar Is Not Nothing Then
Return foo.bar.Description
Else
[Code]....
But are there any problems (performance, purity, other?) with just catching and ignoring the error?
You sometimes read it's expensive to throw an exception but I am not sure whether the author means it's expensive to build in exceptions using the Throw keyword (which I am not doing) or whether he means it's expensive to allow exceptions to occur (as I would be doing).
View 2 Replies
Jun 3, 2009
I have made a tic tac toe board and when i go to debug the application i get a "NullReferenceException was unhandled".
this happens diring this part of the code:
Dim x As Integer = Val(index.Chars(0))
View 22 Replies
Jun 3, 2009
I am getting a NullReferenceException was unhandled error when i run my debugging in this part of my code: Dim x As Integer = Val(index.Chars(0))
what can i do so this will stop and my program will work?
View 1 Replies
Apr 11, 2011
I'm building a voting system for calls, and have tried to build it in VB. So far this is what I have:
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
[code]....
This code is contained within a "Record Call" button. On the form, there are four radio buttons, all with different text values which should be entered in to the "voting" table.My problem is that when I select a radio button and click on "Record Button" it then displays this error:
NullReferenceException: Object reference not set to an instance of an object.
This error is displayed on the line
dsNewRow = ds.Tables("voting").NewRow()
View 3 Replies
Mar 23, 2010
I'm pretty new to VB.NET (VS 2008) so I apologize in advance if my problem is very basic.
I have defined several public arrays with fixed dimension is a public class:
Code:
Now in the main class I'm declaring two global variables:
Code:
I can then redim "parent2.V()" without problem.
Everything works fine with "parent1" but "parent2" gives me a NullReferenceException when I try to read/write from it. Troubleshooting tips tell me "Use the 'new' keyword to create an object instance" which is what I did. How to declare that array "parent2"?
View 4 Replies