How To Achieve The C# 'as' Keyword For Value Types

Apr 14, 2009

Most of our development is done in vb.net (not my choice) and one frequently used code pattern uses an 'On Error GoTo' followed by a 'Resume Next' so that all database fields can be read with a DirectCast() and any DBNull values are just ignored.

The current code would be
On Error GoTo error_code
oObject.Name = DirectCast(oReader.Item("Name"), String)

[code].....

View 6 Replies


ADVERTISEMENT

How To Achieve The Bus Transfer

Aug 28, 2011

I save the bus Information in the two-dimensional array.As follows:

array 0 1 2 3 ..............................
0 106 A B C ..............................
1 102 D A E ..............................

[code]....

Array(x,0) are bus lines,behind its are place.Now I want go to the E form the A(pass 106),but A can't direct to E.But A can pass 102 to E.So line is [106-102].How can I achieve the bus transfer?

View 3 Replies

Achieve My ToolStrip Design?

May 26, 2011

How to achieve my ToolStrip design the same as the picture below?

View 5 Replies

How To Achieve True 50 / 50 Chance

Feb 11, 2009

I know I'm being quite pedantic here. But, what is the right way to get a true 50/50-chance with a generated random number? Say, to simulate the flip of a coin. [code] I know this difference is close to nothing, but I'm doing some calculations on bell curves, in such a way that it requires true 50/50-chance.

View 33 Replies

How To Achieve Using Winform / Webform

Jul 27, 2011

I want a modal screen on startup of the computer, so that user forces to make some action on that screen. Also I want to disabled close button of the screen, It should cover entire Desktop.How to achieve using winform/webform? is parent/child form is the only solution fro this/?

View 1 Replies

What Should Pass To Achieve Block F12 Key

Sep 10, 2009

[code]What should i pass to achieve block the F12 key..

View 7 Replies

C# :: Determining Object Equivalence For Value Types, Reference Types And ILists?

Nov 1, 2009

I have a class with a Property called 'Value' which is of type Object.Value can be of any type, a structure, a class, an array, IList etc.My problem is with the setter and determining whether the value has changed or not.This is simple enough for value types, but reference types and lists present a problem.For a class, would you assume that the Equals method has been implemented correctly, or just assume that the value has changed every time the setter is called?If I did assume it's changed, then perhaps I should assume it for value types as well, so that the behaviour is consistent.

View 2 Replies

Achieve A List With All Possible Combinations Of Letters?

Sep 9, 2009

I was wondering how to achieve a list with all possible combinations of letters. Now there are some nice examples on the Internet, however, I'd like to have the following:

Let's assume you have 3 letters (A, B, C), and have a limit length of 3, then it should display this list:

A
B
C
AA

[Code].....

Now, this would be fine with recursive calls I think, but I find it really difficult to think how to code that and how the computer will execute the code. It would be easier if all possibilities had a length of 3, but here that isn't the case.

View 30 Replies

Achieve Embedded Custom Tags In Asp.net?

Sep 23, 2011

I found this example:

<telerik:RadDatePicker
ID="RadDatePicker1"
runat="server">

[Code]....

Ideally I don't want the FieldConfig class to be a visual class but it's ok if it is.

View 1 Replies

Achieve Simultaneous File Download?

May 23, 2011

I have a class that uses a BackGroundWorker to download a single file using HttpWebRequest and HttpWebResponse

Downloading single file works.

But if I make two objects of that class and start downloading 2 different files simultaneously, there is nothing produced. Execution exits after getResponse() without any error or exception.

Is there any way to achieve simultaneous file download?

View 6 Replies

Achieve The Look Of The Attached Image Using String?

Jun 16, 2009

I am trying to achieve the look of the attached image using string.Format and PadLeft/PadRight but I have no success with it, anyone who could offer some help?

EDIT:The font I used is not mono-spaced and I am not inclined to use a mono-spaced font for this.

View 4 Replies

Achieve Form Controls From The Running Process?

Jan 22, 2009

dim prc1,prc2 as Process
dim f,f1 as form
dim aHandle,bHandle as IntPtr

[code].....

View 4 Replies

How To Achieve Form Controls From The Running Process

Jan 22, 2009

dim prc1,prc2 as Process
dim f,f1 as form
dim aHandle,bHandle as IntPtr

[code]....

View 19 Replies

Possible To Achieve Performance Tuning With Same Thread Concept?

Apr 26, 2011

We have developed a vb.net application using multi-threaded listener concept and a dedicated thread for each folder to monitor. With that we simultaneously keep track of the incoming files in each folder.Currently, we are facing an issue whenever we receive multiple files of bulk volume, parallel processing of the files getting delayed with thread concept or failing sometimes.We need to implement the same logic with some other concept avoiding multi-hreading. Or is it possible to achieve performance tuning with the same thread concept?

View 2 Replies

Use A WPF Control In WinForms To Achieve Transparency Effects?

Feb 10, 2011

Is it possible to use WPF in WinForms, to implement the idea used in this question. I am trying to create a semi-transparent panel.

View 3 Replies

VS 2008 Achieve Mouse Movements With SendInput?

Aug 17, 2009

I�m trying to achieve mouse movements with SendInput.

There is code that got from Pinvoke, [URL]

<DllImport("user32.dll", SetLastError = True)> _
Private Shared Function SendInput(ByVal nInputs As Integer, ByRef pInputs As InputLanguage,

[Code].....

View 4 Replies

Achieve A Drop Shadow Effect Around All Edges Of Form?

May 19, 2009

How would I achieve a drop shadow effect around all edges of my Form?

View 9 Replies

Achieve Acceptable Security Is To Use ASP.NET Web Site Administration Tool?

Dec 7, 2010

Update to my Question the best way to achieve acceptable security is to use ASP.NET Web Site Administration Tool the following is only a demo to use session but it is NOT RECOMMENDED for professional use. follow the advice of PhillFox to achieve better results

[Code]...

View 2 Replies

Achieve CSS With Constant Values , Arithmetic And String Manipulation?

Mar 30, 2012

When developing ASP.NET websites (using VB.NET web forms) - a lot of my time is spend writing CSS files and they always seem to get messy (code duplication) and very long.

All I want to achieve is to be able to manipulate the CSS using VB.NET code in the following ways:

Use an integer variable to store my "golden" number 7 and use that for width, padding, margin etc where needed
Use string variables to store my "golden" hex color codes e.g. "#44C5F2" and use them for color, background-color, border-color etc. where needed Use an integer variable to set the height of an element and have four child elements each with height: mynum / 4

I just want to use basic VB.net number and string manipulation in order to create a CSS file on the fly.

I understand that the end product - the CSS file shouldn't change much - it should at most change on a daily basis otherwise caching couldn't be used.[code]...

View 3 Replies

Achieve Is Split Or Output From Text File For Each Single ID?

Apr 9, 2009

I am having a perl script through which i achieve is split or output from text file for each single ID , the output text file will contain data of that ID and the anme of the file will be ID.txt so if i am having one main file containing 100 or 200 ID's and for each ID's may be 10000 or more lines i would like to have 100 or 200 files containing data for each single ID which i am able to achieve from perl but is it possible from vb.net

open(TH,"myfile.txt")|| die print "not open1";
open(THG,">error.txt")|| die print "not open2";
open(INFO,">myfileAll.txt")|| die print "not open3";
$gt='0';
$flag=0;

[Code]...

View 1 Replies

Compare Two Types In Dictionary Of Types .net?

Jun 23, 2012

I need to compare two dictionary values if the types stored are equal, this is what i have

if gettype(Args(key)) = gettype(argtypes(key)) then
'' do something
end if

[Code]....

View 1 Replies

.net - Does C# Have A Handles Keyword

May 25, 2011

Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick
End Sub

In VB.net, we have the Handles keyword, I'm wondering if C# has anything comparable. Or do you have to manually wire all the methods to each control's event (in ASP.NET especially)?

View 5 Replies

C# - .Net's With Keyword In Java?

Jun 6, 2011

Possible Duplicate: WITH statement in Java? does anyone know if there is the With Keyword in Java?

View 4 Replies

C# - Namespace And Use Keyword

Jul 13, 2010

why use of namespace and use keyword and declaration of namespace

View 1 Replies

C# To Vb: The **default** Keyword?

May 7, 2011

Possible Duplicate:Default value for generics k so while translating some code from c# to vb, i came across the default keyword, and I'm simply replacing it to nothing.

View 2 Replies

Extended With-keyword In .NET?

Oct 29, 2010

In my current project everyone names variables and methods after what they are and what they do. This is good for quickly understanding the code, but with a lot of long varible names comes some headaches, such as when copying a dataset to an entity/object. So, while you understand the code, the readability still takes a blow.

veryLongVariableName.Id = datasetVeryLongVariableName.Id
veryLongVariablename.Something = datasetVeryLongVariableName.Something
etc.

Using VB.NET's With keyword can help.

With veryLongVariableName
.Id = datasetVeryLongVariableName.Id
.Something = datasetVeryLongVariableName.Something
End With

Now, my question, is there any way of using With, or something similar, but for several variables at the same time? Something like:

With veryLongVariableName As a, datasetVeryLongVariableName as b
a.Id = b.Id
a.Something = b.Something
End With

I'm all for descriptive naming conventions, but they do tend to clutter things. Especially in VB!

View 3 Replies

How To Search A Keyword

Oct 26, 2009

I m trying to create a software in vb.net for some genealogists to trace their ancestors History, the users will search for the document in 3 ways

1. reference number from a combo box.
2. By the title of the document.
3. by inserting a keyword from the documents abstract..

i have already loaded the picture. i hav put all in one note pad my reference no., on next line i put my abstract and on the third line i put my path where the document is located.in coding i put all in different array.... making the program read all one by one line wise.i want to make search thru the keyword... means wen user inserts a key word in the textbox the program read all my abstract and then in a drop down it should display the documents that match the keyword.

View 6 Replies

New Keyword But Still Gives Error

May 17, 2012

Its work well in windows 7 but when i run project in windows xp its says i must use New keyword but when i use New its gives error at regkey.GetValueNames and RegistryKey = Registry.LocalMachine and regBaseKey.OpenSubKey("SOFTWAREMyApp", FalseImports Microsoft.Win32[code]...

View 4 Replies

Reserved Keyword In .net?

Mar 13, 2012

in C# you'd put a @ in front of a reserved keyword. Is there any equivalent in vb .net?

View 1 Replies

Use A Keyword As A Propertyname?

May 3, 2011

I have to serialize/deserialize a class into a JSON string/and return. The JSON Strinig must contain the "error" string (like: {error:"something strange occoured", id:23, result:"xxxxx"}), which specifies the occoured error.

How can i implement a class like:

[code]...

If i do this, the word 'error' is invalid.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved