C# Equivalent Of VB Syntax For Property?

Sep 10, 2009

I found the following syntax as a VB.NET property and I'm trying to convert it to c#, but I'm not sure how to accomplish that.

[code]...

View 5 Replies


ADVERTISEMENT

What Is The .NET Equivalent Of This C# Razor Syntax

Nov 29, 2011

In the MVC 3 book by Steven Sanderson on p185 at the bottom, the following expression is used to render the paging links.

@Html.PageLinks(Model.Paginginfo, x=> Url.Action("List", new {page = x}))

What is the VB.NET equivalent? I am stuck on the x url lambda bit.

View 1 Replies

VB Equivalent Of C# Syntax - Dealing With Delegates?

Nov 20, 2009

Is it possible to translate the following C# code into VB.NET, using VB 9.0?

delegate Stream StreamOpenerDelegate(String name);

void Exec1()
{
WorkMethod( x => File.OpenRead(x));

[CODE]...

Can I do something like this?:

Private Delegate Function StreamOpenerDelegate(ByVal name As String) As Stream

Private Sub WorkMethod(ByVal d As StreamOpenerDelegate)
''
End Sub

[CODE]...

I'm trying to write some documentation, but I don't know VB syntax. Often I use Reflector to translate it, but I'm not sure it's working in this case. I'm also not clear on where I would need line continuation characters. In VB9, it's not possible to have multi-line lambdas (or Sub lambdas, which I did not ask about). In VB9, all lambdas return a value, and must be a single expression. This changes in VB10. VB10 will allow the above syntax, but VB9 will not. In VB9, if the logic involves multiple code lines, it must not be a lambda; you must put it into a named Function and reference it explicitly.

Like this:

Private Delegate Function StreamOpenerDelegate(ByVal name As String) As Stream

Private Sub WorkMethod(ByVal d As StreamOpenerDelegate)
''
End Sub

[CODE]...

View 1 Replies

VB SQL Incorrect Syntax Near '' - In Order To Evaluate An Indexed Property The Property Must Be Qualified And The Arguments Must Be Explicitly Supplied By The User

Jun 6, 2009

I receive a System.Data.SqlClient.SqlException in the following code: Specifically Incorrect syntax near ' In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user. The exception detail in its entirety is shown below the code.

[Code]...

View 5 Replies

What's Equivalent Syntax For Anonymous Types In A LINQ Statement

Jun 29, 2010

I'm trying to translate some C# LINQ code into VB.NET and am stuck on how to declare an anonymous type in VB.NET.[code]How do you translate C#'s new { ... } syntax into VB.NET?

View 2 Replies

.net Equivalent Of C# Property Shorthand?

Jan 20, 2009

Is there a VB.net equivalent to the C#:

public string FirstName { get; set; }

I know you can do

Public Property name() As String
Get
Return _name.ToString

[code].....

But I can't seem to google up an answer on a vb shorthand.

View 5 Replies

What's The Equivalent Of VB ReadOnly Property In C#

Jun 12, 2012

If I have VB declaration like this Public ReadOnly Property Document() As XmlDocument, what is its C# equivalent?

View 1 Replies

Sql - Equivalent For Value-property For Controls In Winforms?

May 3, 2012

I'm used to webdeveloping, and when I work with databases, I usually use some text for the Text-property of a radio button, and the row's ID as Value-property. This makes it very easy to save to databases.

Is the an equivalent in winforms for the Value-property, or will I have to identify rows based on the text in the control?

View 2 Replies

ToolStrip Item Property Equivalent In VB6

Jul 15, 2009

I did a VB6 to VB.NET conversion and this line wasn't converted. I'm not sure what property to set that would replace Bevel. What could I use? statusBarMain.Items.Item("PercentBar").Bevel = System.Windows.Forms.Border3DStyle.SunkenOuter

View 2 Replies

What Is Equivalent Property Of Window.document

Jan 24, 2012

What is equivalent property of Window.document in vb.net?Window.document it is the property in vb 6.0.What is equivalent property in vb.net?in vb.net Web browser.document property is available,but I want Window.document equivalent property in vb.net.

View 3 Replies

VS 2008 What Is Equivalent Property Of Window.document?\

Jan 24, 2012

What is equivalent property of Window.document in vb.net?Window.document it is the property in vb 6.0.What is equivalent property in vb.net?in vb.net Web browser.document property is available,but I want Window.document equivalent property in vb.net.

View 1 Replies

Equivalent Of C# Auto Property With Custom Access Specifier?

Jun 28, 2011

I was simply wondering if in VB.Net there is a shorthand equivalent to this kind of C# including the private setter:

public string Test { get; private set; }

View 4 Replies

Equivalent In MaskedTextBox To Cliptext Property In VB6's Masked Edit Control?

Jun 16, 2010

I find this property useful but cannot find a direct replacement for it in vb.net. Is there one?

View 1 Replies

How To Use The Vb Equivalent Of ++ For An Index Property In A Linq Query Projecting A New Type

May 3, 2011

I'd normally do this in C# but since I've got to get this code in this particular assembly which is a vb.net one, I'm stuck.

Here's my linq query:

Dim i As Integer = 0

Dim oldAndCurrentIntersectionOnNames = From currentApplicant In currentApplicants _
Group Join oldApplicant In oldApplicants _

[CODE]...

You'll see the .Index = i+=1

This was my attempt to do what I'd quite happily do in C# (i.e. Index = i++) in VB. Unfortunately the VB compiler doesn't like that. how I'd do this in VB.

View 2 Replies

IDE :: Binding Via Property Element Syntax?

Dec 20, 2009

First, I am making the assumption that anything you can do in "Attribute Syntax" (AS), you can do in "Property Element Syntax" (PES), but not vice-versa. That is the reason I intend on coding completely in PES if possible. I have encountered quirks though.The first issue is regarding AS "x:Name" or PES "<FrameworkElement.Name>": If I use PES, I must make sure it is the last element, otherwise any PES below it will error on build; eg "Value of type 'System.Windows.ResourceDictionary' cannot be converted to 'Namespace.ClassName'."

A problem encountered intermixing AS and PES: Set "x:Name" and "MinWidth" as AS. Set "Title" as PES.

[Code]...

View 1 Replies

Use Structure, Property Or Enum Syntax?

Nov 10, 2011

I think it's substituable for just Dim, Public or others. What is merit by using structure, property ??

View 1 Replies

Syntax To Change The Value Of A Cached Object Property?

Jun 6, 2010

In an ASP.NET 3.5 VB web app, I successfully manage to cache an object containing several personal details such as name, address, etc. One of the items is CreditNum which I'd like to change in the cache on the fly. Is there a way to access this directly in the cache or do I have to destroy and rebuild the whole object just to change the value of objMemberDetails.CreditNum?The cache is set using:

Public Shared Sub CacheSet(ByVal key As String, ByVal value As Object)
Dim userID As String = HttpContext.Current.User.Identity.Name
HttpContext.Current.Cache(key & "_" & userID) = value
End Sub

View 1 Replies

Syntax/Command Trying To Implement Syntax Highlighting In RichTextBox?

Oct 12, 2011

I am having an issue trying to figure this out. I am writing a script editor that uses tabs (a tab control) and I want to implement syntax highlighting. My issue is that every sample I can find on syntax highlighting uses

Private Sub RichTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged

View 1 Replies

.net - 'Property' Cannot Implement 'Property' Because There Is No Matching Property On Interface 'IName'?

Dec 9, 2011

I'm having some very weird issues with interfaces right now.

I have a very simple setup. In one of my class, I have a Property implementing a Property from an Interface.

In my class it's like:

Private _oForm As IForm
Public Property Form As IForm Implements IContainer.Form
Set(value As IForm)

[Code]...

I have like dozens of interfaces like this working throughout my project and I can't believe this simple one can't work!

View 1 Replies

C# - Syntax Conversion - Translate Syntax ?

Dec 16, 2009

Can any one translate the following syntax to vb.net.

m_TextBox.Loaded += TextBoxLoaded
m_TextBox.Loaded -= TextBoxLoaded;
private void TextBoxLoaded(object sender, RoutedEventArgs e)[code].....

View 4 Replies

Convert Late Binding Syntax To Early Binding Syntax In .net?

Sep 5, 2011

i have this code:Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[Code]...

Error 1: Option Strict On disallows late binding.Im using visual basic 2010 express on a gateway laptop thats running Windows 7 OS How do i resolve this error?

View 2 Replies

Convert Late Binding Syntax To Early Binding Syntax?

Apr 9, 2009

I have a listbox and it it I am showing numbers.It should look like this (line by line) 1,2,3,4,5,6,7,8,9,10,11.....but is is showing it like this 1,10,11,...2,20,21...3,30...ow can I make it that it will show it in number order 1,2,3,4,5......

View 5 Replies

Syntax Error: Syntax Error: Missing Operand After '14' Operator

Oct 21, 2009

I want to select some rows from a sql express 2005 table. I am using this expression: "Starttime >= " & dtpStart.Value dtpStart is a DateTimePicker But I am getting this error: Syntax error: Missing operand after '14' operator.

View 18 Replies

.net - If An Interface Defines A ReadOnly Property, How Can An Implementer Provide The Setter To This Property

Jun 10, 2011

Is there a way for implementers of an interface where a ReadOnly property is defined to make it a complete Read/Write Property ?

Imagine I define an interface to provide a ReadOnly Property (i.e., just a getter for a given value) :

Interface SomeInterface
'the interface only say that implementers must provide a value for reading
ReadOnly Property PublicProperty As String
End Interface

This means implementers must commit to providing a value. But I would like a given implementer to also allow setting that value. In my head, this would mean providing the Property's setter as part of the implementation, doing something like this :

Public Property PublicProperty As String Implements SomeInterface.PublicProperty
Get
Return _myProperty

[code]....

View 5 Replies

Reflection - Find From A Property Info Object If That Property Has A Non Public (Private / Protected) Setter?

Aug 27, 2009

I searched on the forum / Internet for the solution how a PropetryInfo object (of a Public property) can reveal if it has a Private Protected Setter ... it was all in vain .... all help I found was about how to "Set" value of a public property having a Private Setter.I would like to know if I have a PropertyInfo object of a public property, how would I know if its Setter is Non Public?

I tried, in a exception handling block, where I did a GetValue of the PropertyInfo object and then called SetValue by setting the same value back... but to my surprise it worked well and didn error out.

[Code]...

View 1 Replies

Error - In Order To Evaluate An Indexed Property, The Property Must Be Qualified And The Arguments Must Be Explicitly Supplied By The User

Jun 20, 2012

I'm having a few problems converting some code into VB.NET from C#. Most of the translating is done, but I am getting errors when I try to run my code, and I can't figure out what is causing them. Here is the Sub I translated.

Public Sub CreateWidget()
Dim blue As LCDColor
blue.Red = 0
blue.Green = 0

[code]....

The error I receive on this line ("vision.Widgets.CreateWidget(wg1)") reads "In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user."

View 11 Replies

Runtime Error '-2147418113 (8000ffff)':Could Not Get The CurLine Property. Unexpected Call To Method Or Property Access

Sep 24, 2009

start with I was given a program by a friend that was created in Excel 2003 with the help of Visual Basic Editor. He said he used Visual Basic 2003, which he is not 100% sure about. Anyways he used CurLine in the program and when I try to open it in Excel 2007 and then open the Visual Basic Editor and run the program I get the following error:Run-time error '-2147418113 (8000ffff)':Could not get the CurLine property. Unexpected call to method or property access.

View 2 Replies

.net - Make A Class Property Behave Like The Checked Property On RadioButton?

Jun 1, 2012

I have a very simple class that holds a few public properties - ID, Text, Colour, etc. and a Boolean called 'SelectedItem'. Just like the Checked property on RadioButtons, only one item can have its SelectedItem property set to True within a particular group. Note: there will be several separate groups (lists), each allowed to have only one item with SelectedItem = True.

My first thought was that I would probably just have to handle everything outside of the class, setting SelectedItem to False for every other item in a particular list when another item was selected. But that seems rather inelegant to me. So I've been trying to think of how this might be done within the class. For example: could I perhaps have a private string property called say "GroupName" - set in the New sub when adding a new instance of the class - and then use a private shared method to set every item's SelectedItem property to False, provided the item has the same GroupName as the newly selected item? I would have a go at doing this but I have no idea how to enumerate every instance of a class from within that class, or whether that's even possible. Is it? Or is there another (better) way to achieve my goal? Here is a cut-down version of what I've got so far:

Public Class ResourceItem
Public ID As Integer
Public Text As String[code]....

As can be seen: instead of instantiating a new ResourceItem and passing that as an argument to the manager's Add procedure, I'm simply passing the details of the new item and the procedure is creating the item from those. I don't know whether this is a good or bad idea - please advise - but I've done it because I couldn't figure out how to make the SelectedItem property only writeable by the manager, so I wanted to avoid having directly accessible objects that could have their SelectedItem property set to True without it deselecting all the other items in the same group. Of course that still leaves the possibility of setting a variable to one of the manager's list items and setting it from there, so I would still like to know how I could prevent that, if possible.

UPDATE: I didn't use the code above in the end, deciding instead to go with Cyborgx37's solution - which seems to work perfectly well for me despite the warnings about best practice. I also realised I would need to use the same class in another scenario where multiple items could be selected, so it was easy to add a Boolean property to the manager to enable that.

View 2 Replies

Asp.net - Identifier Expected And Property Access Must Assign Property Or Use Its Value Errors

Nov 14, 2011

Using the following code I get Identifier expected and Property access must assign property or use its value errors:

ViewState["SomeKeyValue"]
What is wrong with this code?

View 2 Replies

Bind A Dataview.count Property To A Textbox.text Property?

Aug 3, 2010

I have a dataview an i would like to show the count property in a text box.

i tryied the following

me.textbox1.DataBindings.add(new DataBindind("Text",DataView,"Count"))

But i have a exception.

View 10 Replies







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