Reasons For Inconsistent .NET Syntax?

Jul 8, 2010

Does anyone know if there's any particular reason that VB.NET construct syntax isn't consistent? For example:

If End If Select End Select You'd assume it would be for... end for, while... end while ... but instead we have:While.Wend For Next This has mildly frustrated me for a while, and I just got to wondering whether there was any conscious decision behind it. Or was it just an initial not-so-well-thought-out design decision that can no longer be changed because of backwards compatibility problems?

View 3 Replies


ADVERTISEMENT

Inconsistent Combobox Behaviour?

Sep 12, 2011

I have an application which was developed in vs2005 with numerous forms which use the combobox for selecting from lists of items. The usual setup is as follows:

Combo.Datsource = BusinessObject

Combo.DropdownStyle = DropDownList

Combo.AutoCompleteMode = SuggestAppend

Combo.AutoCompleteSource = ListItems

However, compiled under vs2005 when tabbing to a combo and typing a number of characters the combo would highlight the first matching item and on pressing tab, would select it and the user would move to next field.

With vs2008 the same item might be highlighted but pressing tab doesn't select the item unless its the only item matching the first character. The only way of selecting the item highlighted from the suggestappend is to press enter prior to the tab key.

I also noticed some users experiencing the same behaviour when the app was compiled with vs2005 on some PC's but not others as if it had something to do with the PC config.

Has anyone any ideas how to get around this as it can lead to errors in data capture.



Kind regards.



View 8 Replies

.net - Inconsistent Behavior From Declared DLL Function?

May 21, 2010

Why might my GetRawData declared function return a correct value when called from my VB.NET application, but return zero when called from my ASP.NET page?The code is exactly the same except for class type difference (Form / Page) and calling event handler (Form1_Load, Page_Load).

Note: In the actual code, #DLL# and #RAWDATAFILE# are both absolute filenames to my DLL and raw data file respectively.

Note: The DLL file was not created by Visual Studio.

Form1.vb
Public Class Form1
Declare Auto Function GetRawData Lib "#DLL#" (ByVal filename() As Byte, _
ByVal byteArray() As Byte, _

[code]....

View 3 Replies

.net - Xaml TextBlock Width Inconsistent ?

Jan 18, 2012

Look at this simple bug :

<textblock (...) Width="0" />

Working great, the textBox appears to be 0px thin. Works with value like, 2, 3, 4...

Now that is NOT working :

<TextBlock (...) />
<TextBlock.Width>
<MultiBinding Converter="{StaticResource WidthConverter}">

[CODE]..................

Why can i set zero value to TextBox.Width in xaml and not in code behind ? By using a converter, when returing 0, the TextBlock.Width is not set to 0 but to "auto", i can read the text

View 1 Replies

IDE :: Inconsistent Behaviour When Filling Arrays?

May 29, 2010

This works:

Dim zArray(5) As String
zArray = (From zS As String In zArray Select "HelloWorld").ToArray

This doesn't:Dim zArray(5) As String = (From zS As String In zArray Select "HelloWorld").ToArray

It seems inconsistent to me, though I may be missing a subtle difference instead of it being an IDE inconsistency?

View 3 Replies

IDE :: Treeview With Imagelist Inconsistent Behavior?

Dec 10, 2009

I have a treeview with Imagelist assigned to it. I find inconsistent behavior with the Images being displayed in treeview. When I run the app sometimes the images show up and sometimes they don't.

View 4 Replies

Inconsistent Line Endings Error

Apr 17, 2011

I wrote a software for auto-generating some lines of code. However when I do a copy and paste of that code in a class after reopening it again I confront an Inconsistent Line Ending Erros.[code]...

View 2 Replies

VS 2005 Contextmenustrip - Inconsistent Dropdown?

Apr 6, 2009

I've got a contextmenustrip with a couple levels of dropdowns (submenu items). Let's say I right-click the form and show the "main" set of items, one of which is "Food". If I move the mouse over Food (not click it), a dropdown (submenu) for Food should open, which it does. But then, say, one of the food items is "Fruit". When I move the mouse over "Fruit", the Fruit submenu should open automatically - but it does not always - sometimes it does, but sometimes I have to click it to open it. Furthermore, once "Fruit" has been clicked once to open, any other dropdown items (let's say we had "Veggies" and "Meat") will automatically open as I expect; and then "Fruit" will behave as expected also.

Any ideas on how to correct this inconsistent behavior? (i.e. all sets of dropdowns associated with a contextmenuitem should open when the mouse is moved over it, a click should not be required)

View 2 Replies

OLEDB For Excel: Inconsistent Insert Results?

Jan 13, 2010

OVERVIEW:I am currently having an issue loading a large number of rows into Excel. I say large because the attached code in fact correctly inserts 50 rows into an Excel worksheet, however, as the number of rows increases to no more than500 rows the data is not inserted into the worksheet. No error is thrown by .net and the .xls filesize actually shows an increase in size, however, when the file is opened there are no rows in the spreadsheet..... Then, when the .xls file is closed the filesize is once again reduced.

Again, the code works for a small number of rows. Are there any known bugs with the OleDB driver for Excel?ADDITIONAL THOUGHTS:I have tried inserting rows to both Excel 2003 and 2007, same issue.I have tried closing the connection after each insert.... performance if horrible and it does not fix the problem.I have wrapped the ExecuteNonQuery in a transaction.... no go....

[code]...

View 1 Replies

Parallel.For With Nested Loops Causing Inconsistent Iterations?

Dec 23, 2010

I'm trying to implement parallel computing using .NET 4 on an asp.net website housed on a clustered server consisting of 6-8 dual core servers. My original script contains two nested For...Next loops iterating through a range of values in a grid of x by y.

For each point in the grid (x,y), we should perform a computationally intensive subroutine called MakePartsMatrix which accesses a SQL server database with dataviews and manipulating the local variable "unfilled" which is passed in ByRef.

Without the parallel implementation, the nested for loops work fine except its slow -- taking about 60 seconds to run.

When I parallelize the outer For loop, the script is about 50% faster, completing its calculations in 20-30 seconds which is great. However, I have noticed that the parallelization causes random parts of the grid to be either completely skipped (eg, grid (1,5) is never evaluated by the MakePartsMatrix), or some points in the grid (eg, x=10 & y=5) to be evaluated multiple times, resulting in duplicate work.

When I parallelized only the inner For Loop, the script execution time also improves by 50%, but now the last row (y-1) in the grid is skipped entirely and the results in "unfilled" are completely wrong.

When I comment out the "MakePartsMatrix" subroutine, the parallellization (either inner or outer For loops) does appear to visit every point of the grid (x,y) once, and only once.

Dim ConcurrentListofResults As ConcurrentQueue(Of FindBestResults)
ConcurrentListofResults = New ConcurrentQueue(Of FindBestResults)
Dim FBSResultsItem As FindBestResults

[Code].....

View 11 Replies

Unit Test Inconsistent Pass Or Fail Result?

May 16, 2011

One of my unit tests seems to randomly pass or fail when I run it. The only thing that makes sense to me for why this is happening is if the data in the database is getting into a different state each time the test is ran, but I use transactions to rollback the database in each test - unless it's not working right. Here's my base unit test class and the unit test class that's having the problem. Can you see anything I might be missing or what else I should look for?

This happens with TestDriven.Net and the Visual Studio Unit Test Framework.

[Code]...

View 3 Replies

Cannot Open Newly Created File - Inconsistent Line Ending

Jan 20, 2010

I wrote a program that writes to a new created file a line of text. Anytime I try to open the new created file, I see a dialog box titled "Inconsistent Line Ending". I do understand why I receive this message. I wrote this program in VB.NET.

View 1 Replies

Chart X Axis Labels - Label Display Is Inconsistent - VS 2010

Aug 2, 2011

I'm seeing a strange problem with the labels on the X axis of my charts. I've setup two chart areas and aligned them (which displays fine) and the user can manipulate the chart by selecting different date resolutions (Year, Month, Day, Week, Hour) and different time periods.

The issue I'm seeing is that if a user selects say Months as the date resolution the X axis label display is inconsistent. If a fairly broad range for the dates is selected the X axis displays absolutely fine but as the date range narrows the X axis starts to duplicate labels ( please see the attached images). The second Image had a date range of 1st of May to 1st of August and as you can see the labels are duplicated. This is my first go with the chart control so I could be missing something basic. [Code]

View 1 Replies

VS 2008 - Process.Start() - Inconsistent - Load A File On Network

Oct 22, 2009

Im simply trying to load a file on my network. The file is a database file for access.. This code opens the file on my computer. However on the four computers tested 2 of them throw an error stating that the user canceled the operation. However the user didn't do anything. The error is thrown automatically. The other two are working perfectly fine.

[Code]...

View 2 Replies

IDE :: Inconsistent Error "Reference Required To Assembly Containing The Base Class?

Mar 3, 2009

I have a Visual Studio 2008 solution with project A referencing project B as a project reference. Project B references System.Data.Linq, but project A does not. Everything compiles and runs fine. I like this arrangement because avoiding a reference to System.Data.Linq in project A ensures that it uses project B methods instead of directly accessign System.Data.Linq methods, which I want to avoid.

View 3 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

VS2010 Inconsistent Exception Thrown And Handled: AccessViolationException - Attempted To Read Or Write Protected Memory - Is This A VS Bug

Oct 2, 2010

I have a class library that uses the IApplicationAssociationRegistration Interface [URL]

Heres the code:

Class Library
IApplicationAssociationRegistration Class:
Imports System.Runtime.InteropServices

[code]....

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

IDE :: Inconsistent Build Response - Throwing 'Build Failed'

Nov 27, 2011

A particular VB.NET project is actually throwing 'Build Failed' But when I try rebuilding again it says 'Rebuild Succeeded'. It keeps alternating this behavior. Kind of random. Any vbc.exe issue of long locking the PDB or xml files?

View 9 Replies

.net - The Member 'X' Was Changed To Be Inconsistent With The Association Member 'Y'?

Jan 3, 2011

I get this error if I follow these steps: Change property Y of an object (an associated entity property)
Attempt to submit changes At this point the value of Y and the value of X (the underlying key) are not in agreement -- LINQ to SQL apparently doesn't synchronize these until GetChangeSet is called.An expected error occurs due to some business logic or database level constraint during the update operation.At this point the value of Y is in agreement with X because GetChangeSet was called.Change the value of Y to Nothing (aka null).Call GetChangeSet.

The error occurs on the last step because the value of X and the original value of X (returned by GetOriginalEntityState) are different, and the new value does not agree with Y? Is that why? Is this a bug in LINQ to SQL. Must be because I don't see the same behavior if I change Y to another (non-null) value instead during step 5. What's the right way around this? I can see a few ways:

Discard the DataContext when an error occurs and leave the UI as-is. I don't like this because then optimistic cocurrency change conflicts cannot be detected. The new context doesn't have the original values in it that were populated at the same time the UI was populated, so if the UI has any stale values in it, they will cause data in the database to revert.Refresh the datacontext (OverwriteCurrent) and leave the UI as-is. I don't like this for the same reason as #1.Refresh the datacontext (OverwriteCurrent) and re-populate the UI. I don't like this because then the error message just presented to the user does not show the user the error they made and allow them to correct it. It also discards all the other changes the user may have made.When the error occurs, explicitly retrieve the key for Y that corresponds to the original value of X and reset Y, then call GetChangeSet to re-synchronize X (X is read-only or private so I can't reset it directly). This seems to work, but seems like a hack, and may require lots of code for other similar errors.

View 2 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

Asp.net - Regarding Syntax In C# And Vb

Aug 7, 2009

I have a web service in c# and its working well in c#.Following is one method i used in it

[WebMethod(EnableSession = true)]
public void abc(BllNew objNew)
{
new DAL.Entity.BllNew().sample();
}

But again i implemented above method in vb and is like this

[WebMethod(EnableSession = true)]
public void abc(BllNew objNew)
{
new DAL.Entity.BllNew().sample();
}

One syntax error is showing near 'new' keyword.What change i hve to get rid of syntax error.

View 2 Replies

C# Syntax To A Vb-er

Sep 11, 2009

I have the following code snippet:

CODE:

I do not understand the

CODE:

Can someone explain it? For the record...dropOperation is an enum. Can you give vb syntactical equivalent is all I need.

View 10 Replies

Sql Syntax To Always Get One?

May 25, 2011

SELECT dbo.Calls.Description, dbo.TicketRead.IsRead, dbo.TicketRead.UserID
FROM dbo.Calls
LEFT OUTER JOIN dbo.TicketRead ON dbo.Calls.CallID = dbo.TicketRead.TicketID
WHERE dbo.TicketRead.UserID = 1 or is null

I want to get a list of all calls, but also a value indicating if the user have read the call. so I made when a user open's the ticket a new record is added in a special table. now if no user have read it then it's ok, but if just one user have read this ticket, then the other users don't have this call in the list..

View 2 Replies

Syntax For An Old Vba?

Apr 29, 2012

just starting out to learn vb.net. I am doing so cuz i have some vba stuff i need to port.orry for the beginner question: translate this code I use in Outlook to vb.net? I know it's not complete, but I am stuck here.

Private Sub Application_ItemSend(ByVal Item As Object, ByVal Cancel As Boolean)
Dim objNS As NameSpace
im objFolder As MAPIFolder

[code]....

View 1 Replies

Wcf - What Is This Syntax In .NET

Feb 6, 2012

The following is from a WCF sample I am working on.

<ServiceBehavior(InstanceContextMode:=InstanceContextMode.Single)> _
<Foobar()> _
Public Class Service1

I've never understood this and just used examples, but I would like to understand what is going on here. What exactly is the stuff inside the <> brackets? How are these related to Service1? I understand the ServiceBehavior is related to the hosting, but what about Foobar?

View 2 Replies

ASP VB Syntax Error?

Jun 7, 2012

I'm trying to display an aggregate feed of several RSS feeds. I'm doing this with an asp page.The problem is I'm getting the error message:Microsoft VBScript compilation error '800a0401' Expected end of statement for the line:Dim feed As SyndicationFe

View 1 Replies

Asp.net - SQL: Incorrect Syntax Near

Apr 7, 2011

I used to have this one

Dt = MyMod.GetDataTable("SELECT TOP " & QuestionsPerCats(i) & " * From Questions WHERE CategoriesID ='" & Cats(i) & "' ORDER BY NEWID()")

but now i decided to use sqlparameters like

Dim cmd As New SqlCommand("SELECT TOP @QuestionsPerCats * From Questions WHERE CategoriesID = @CategoriesID ORDER BY NEWID()", conn)
Dim sqlParam As SqlParameter = Nothing
sqlParam = cmd.Parameters.Add("@QuestionsPerCats", SqlDbType.SmallInt)

[code]....

and returns the following error

Incorrect syntax near '@QuestionsPerCats'.

View 3 Replies







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