Marking Parameters As Nullable?
Dec 22, 2009
I've picked up some code from a colleague, and in one of his methods he has a boolean parameter: ByVal showProactiveChases As Boolean?. I had to look up the ? operator yesterday to see that it denotes a Nullable type. My question is, if I change it to: ByVal showProactiveChases As Nullable(Of Boolean), does the meaning remain the same? I think provided it doesn't change the meaning the second way is much more readable.
View 4 Replies
ADVERTISEMENT
Aug 31, 2011
typeof(Nullable<>)
public static bool IsNullableType(Type t)
{
return t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>);
}
I was using this to check whether Lamda Expressioin parameters are nullable.
View 3 Replies
Dec 25, 2011
My application security from piracy depends upon fields in my databases. User has to activate the application, that writes Bought in my database. But the problem is if a new user installs my application and replaces all databases from some one who has bought key, the application also becomes active without buying key from me.
Is there any possibility that I could mark the databases to be recognized with the particular setup?
View 1 Replies
Jul 10, 2011
ToSerializable is it possible instead of marking a Class with the <Serializable()> attribute?
as in the following Class.So you could maybe do:>>myObject.ToSerializable
<Serializable()> _Public Class ExampleClass
End Class
View 11 Replies
Aug 10, 2009
I have a datagrid in my VB form. I want to lock in a way that you can not mark any cells in the tables etc.
When I set it to read only I stop the edit function but you can still mark the cells with a cursor. Is it a way to avoid that from happening?
View 1 Replies
Feb 15, 2012
I had a need to mark a listview row if filenames were duplicates for n number of characters from the left. I wrote the following but it smacks of VB6.[code]...
View 5 Replies
Dec 9, 2010
I have developed an active x control and signed it with certificate. I know that digital signing is needed , so that the browser knows that the active x comes valid source.My asp.net form has a button , which invokes a method on activex control as -[code]....
But it errors on browser stating that the - IE has blocked this site from using an active x control in an unsafe manner. ( Please see attachment).So should I have to develop the active x control which implement IObjectSafety and also signed digitally, so that it can execute on client browser without any warnings from IE. Any examples.
View 1 Replies
Jul 19, 2009
I have a macro written in VB in Excel, which reads emails from Outlook. I would like to automatize this process, but everytime, when Excel wants to access the outlook, I have to give permition to do that, see http://apophis.wz.cz/permition.PNG (It's in czech, but you will see the point). Is there any way to give this permition for ever? Or for long time, such as 10 hours? (I can choose max. 10 minutes).
View 1 Replies
Apr 18, 2010
new to VB and having some problems with my code.the story is that while marking items in comboBox1 need to pass values to 3 different comboBoxes so far I have made code that pass data only to one comboBox. [code]
View 1 Replies
Sep 17, 2009
I accidently wrote some code today that was like this[code]...
I immediately noticed the issue, but I had already hit the run button. It compiled successfully, I ran it through to the section and it threw an exception.
You can't do this in C#, it gives a compile error "cannot convert from 'int?' to 'int'".
Is there an 'Option Explicit' type switch that I can turn on to ensure that this sort of error does not occur again?
View 1 Replies
May 13, 2011
I'm writing a query to select all records that has any part of parameter. I have one table called Employees. Some people have name like this: John David Clark If the parameter is
[Code]....
I should be able to get result back as long as there's a match in the parameters. If I use Function Contains (q.FirstName & " " & q.LastName).Contains(employeeName), I will not get any result back if employeeName is "John Clark" Function Contains looks only for next words from left to right. It doesn't match a single word at a time. So that's why I used this in the Linq to SQL:
[Code]....
View 2 Replies
Aug 30, 2010
I am getting error [07002] the # binded parameters < the # of parameters makers, i checked both parameters were perfect even though i am getting this error here is my code
[Code]...
View 1 Replies
Feb 6, 2012
Basically Commands has Parameters and parameters has functions like Add, AddWithValue, and etc. In all tutorials i've seen, i usually noticed that they are using Add instead of AddWithValue.
[Code]...
since it saves my coding time. So which is better to use? Which is safe to use? Does it improves performance?
View 2 Replies
Aug 6, 2011
is there a way to get the GET parameters and POST parameters in just one function or Collection in ASP.NET? Like using $_REQUEST in PHP? I'm using VB.NET.
View 3 Replies
Dec 5, 2011
I have a bigger code block which I have recreated in this simpler example:
[Code]...
View 1 Replies
Aug 27, 2010
I have: Dim nVar1 As Long?Dim nVar2 As Long?Dim nVarSum As Long?nVar1 = Nothing nVar2 = 5 nVarSum = nVar1 + nVar2 I would prefer the result to end with nVarSum being 5, instead of Nothing. I understand if you add something to an unknown value, you will end up with "somthing + unknown" or x+5 will always equal "x+5" not "5" because you are still carrying around that unknown "x". However, how can I effectively treat an unknown or Nothing as a zero for the purposes of addition in this case?(What is basically happening is that the end user is sending us a data file, this code parses that file and then sums together about 15 fields. If the user leaves those fields blank instead of assigning a zero to them, I need to treat it as if it was a zero for this one addition operation, but all the rest of the code needs to continue seeing it as a Nothing value since the user did not ACTUALLY submit zero... they submitted blank or nothing)
View 3 Replies
Jun 27, 2012
Can Nullable Types be used in VB.NET? If so, is it possible to have a Nullable Integer that I can use with a field that accepts NULL in SQL Server?
View 4 Replies
Aug 25, 2010
I'm converting an Access VBA app to VB.NET. It has dates defined as variants or objects to handle null values. I thought this would be a great chance to use the Nullable type. But I can't get it to work. Either it is inappropriate for what I am trying to use it for, or I am doing it wrong. Anyone know how to use it? Reader is a SqlDataReader.
[Code]...
I was hoping I didn't have to put a lot of If .. Null statements throughtout the code, but that is my only option unless someone has any other idea.
View 11 Replies
Sep 15, 2011
I have the following line of code:
CType(IIf(CBool(product.IsDiscontinued Is Nothing Or product.IsDiscontinued = True), False, True), Boolean?)
What does the Boolean? mean at the end. I have seen it used on other data types as well.
View 3 Replies
May 6, 2009
I have a Nullable DateTimePicker but it lacks a vital property, that is to be able to change its ForeColor, anyone who has some suggestion on how can this be done? Or perhaps a free nullable DateTimePicker out there that supports changing of backcolor and forecolor?This is C# but it should not be different with .Net, and I prefer posting it here since there is more traffic here over the C# section.
using System;
using System.Collections.Generic;
using System.ComponentModel;[code].....
View 2 Replies
Jan 31, 2012
Okay, none of the previous questions I have seen with this error seem to apply in this situation.tEmp is a class that contains (among other things) two nullable date fields.[code]During a routine on my form, I am attempting to see if the following conditions are true[code]I get the above error (the title of question), but when I hover over the debugger, NextReview and InsuranceEligibleDate are both Nothing (which is correct for the employee I am looking at).I am using VB2010, and the Properties in the Employee class are using the new way of declaring Properties (i.e. no set/get)
View 4 Replies
Dec 15, 2010
dim str as nullable(of string) is this syntax incorrect?
View 1 Replies
Feb 15, 2011
C#'s 'as' keyword will let you do this: int? input = value as int? Here's what I would assume the vb.net equivalent would be: Dim input As Integer? = TryCast(value, Integer?) There's an intellisense error in the TryCast stating the operand must be a reference type but Integer? is a value type.
Intellisense on Nullable(Of Integer) says 'Represents an object whose underlying type is a value type that can also be assigned null like a reference type.' It seems C#'s 'as' handles this like a reference type where TryCast doesn't have this built in. In VB10 I was able to take advantage of the new CTypeDynamic function to do the casting. Conversion.CTypeDynamic Method
Dim input As Integer? = CTypeDynamic(Of Integer?)(value)
Or:
Dim input As Integer? = CTypeDynamic(Value, GetType(Integer?))
There's a cost here as CTypeDynamic examines the type at runtime.
My question is what is the elegant way to handle this without CTypeDynamic?
View 6 Replies
Nov 15, 2011
Dim input As Integer? = TryCast(value, Integer?)There's an intellisense error in the TryCast stating the operand must be a reference type but Integer? is a value type.Intellisense on Nullable(Of Integer) says 'Represents an object whose underlying type is a value type that can also be assigned null like a reference type.'It seems C#'s 'as' handles this like a reference type where TryCast doesn't have this built in.
View 1 Replies
Nov 17, 2010
I am a c#/asp.net developer and I am having to work on a VB/asp.net. I have two variables
Dim originalDate as DateTime?
Dim newDate as DateTime?
Both nullable datetimes, originalDate is a nullable date I am getting from the database and newDate time is set in code, I need to compare them, they can either both have dates, neither have dates or one have and one not.
I have a bit of code as follows:
if origEndDate = origEndDate then
When both origEndDate and origEndDate are "nothing" this statement is false (well when I run it in the watch window it comes back as nothing)!I don't understand why this is the case because I was under the impression doing an "=" compares the two values and as they are the same surely it should be true? What syntax should I be using as in C# I can do the above as so:
if (origEndDate == origEndDate) { }
and it will come back as true.
View 4 Replies
May 8, 2011
assuming v is a nullable, I'm wondering what are the implications / differences between these usages:
VB:
If v Is Nothing Then
If v.HasValue Then
C#:
if (v == null)
if (!v.HasValue)
View 4 Replies
Apr 7, 2009
I am creating a setup project for my VB application. Everything seems to look fine. However when I tell it to build the solution I get the following error:Property 'keycode' is non-nullable. I have never seen this before in other setup projects and I can't find any help from MS.
View 8 Replies
Jan 17, 2012
In the below sample code, I have tried to use Nullable(of T) for DateTime and I want to use it same of the Dimensions property which is List(of Dimension).
CODE:
View 1 Replies
May 20, 2009
I am getting an unusual error "Nullable object must have a value" when running the code below.
[Code].....
Interestingly the Stored proc used by the table adapter still runs and does the insert but the function returns the error.
View 8 Replies
Jun 3, 2010
For a project I need to convert a date field in my SQL Server 2008 Database into a VB.net ListOf. Most of the records in StartDate field are NULL. VB.net doesn't recognize null values for DateTime.I need the NULL values to be dismissed, as they will be returned in a ListOf for a web service that I'm creating.
Here is my syntax and a sample of the current returned values in the XML message of the ListOf:
Class Property StartDate() As System.Nullable(Of DateTime) = Nothing
asmx.vb myUserRoleAppInfo.StartDate = myPermissionUser.StartDate
XML Message (Listof)
[Code]...
View 4 Replies