vb.net

How do I use ENTITY DATASOURCE to Insert Data into a TABLE using OnInserting Event ?

I have two tables: AspnetUsers Userid uniqueidentifier NOT Null PK UserName Nvarchar (256) NOT Null More column More Column UserProfiles UserId uniqueidentifier Not null PK FK Default (newid()) Username Nvarchar(256) Not Null More columns, More More columns There is a constraint between the 2 tables. When a user is insterted...

Anyway to determine file size before upload?

So we're having this problem. A user goes to upload a file, and if it's above 10MB, it just kind of times out the page, and clears, and no good error is thrown to describe what happened. Ideally, we would like to examine the file size when the user chooses the file they want to upload but I don't know if this is even possible. Our framew...

VB.net - storing values

I've been using the following method to store the primary key value of whatever record is being referenced. I would then call the Content.Id method to retrieve that value for sql commands. My question is - is this good practice? One other told me I should make a session item instead. This is my ContentDA class Public Shared Property I...

DataGridView.Editmode = EditOnEnter. How to Select the row to Delete it ?

When I use EditMode = EditOnEnter, The cell enter on editmode when I select the row. It is hard to user to select the RowSelector to Delete the row. do you know any Trick ? ...

Form hangs up - VB.NET 2008 (on 64 bits Vista)

Hi: I have detected a problem running my application under Vista 64 bits OS. My application is developed using VB.NT 2008 and compiled as x86 I have a main form. In this form there is an option to open other form. TThis second form must return a few values to the main form. When the user click on this 2nd form, to return values, this...

Reasons for inconsistent VB.NET syntax?

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 w...

Datagridview cell turns black when accessing EditedFormattedValue?

I have a winforms application that uses a datagridview. When I access the EditedFormattedValue of a cell while it is in edit mode, sometimes, but not always, the whole cell turns black. Is this a feature of the datagridview, perhaps some sort of validation feature I need to turn off? I have found a couple of other mentions of this pro...

How to join with multiple (OR) conditions in LINQ to SQL?

How would I perform this SQL query Select Distinct s.* from #ScopeIDs x Join Scopes s on s.ScopeID=x.ScopeID or x.ScopeID is null in LINQ to SQL? (This query would return all Scopes whose ScopeID is present in #ScopeIDs, unless one of the entries in #ScopeIDs is null, in which case it returns all Scopes). A "literal" translation d...

Showdialog problem

I'm using PDFSharp to develop an application. This library has a class called PdfReader wich has an Open Method and one argument of this method is an event delegate. Private Sub PasswordProvider(ByVal args As PdfPasswordProviderArgs) In this method you have to use args.Password to set the password of the pdf document you're trying to ...

Can't find database path after exporting

I have vb.net application which is using Vistadb with following connection string. I am able to export data to excel also. But after exporting to report different than to application directory, program crashes and says that database not found in exported directory. i believe that there is something wrong in connection string but I van't ...

Export to Excel file as .zip to reduce file size. How to compress xmldata before sending it to the client?

I like to compress the xmldata before the data is provided to the client as an excel file. I am trying to compress and deliver it as a .zip file. its not working Here's my code below. Please help I tried compressing it, converting it to bytes etc etc. The issue with below code is, the XSL transformation is not happening properly and the...

WinForms: Cannot get ValidateChildren to raise Validating event of a child control.

In a Windows Form application I have a Form with a UserControl that contains a child control. I have an event handler for the child control's Validating event. On the parent UserControl I call the ValidateChildren() method. But the event handler for the child control's Validating event does not run. The CausesValidation property is s...

variable declaration question mark

I was looking at some existing code and stumbled across a variable declaration I didn't understand. public foo as Boolean? What does the question mark signify? ...

What’s the best way to calculate the size of a directory in VB .NET?

I need to calculate the directory size in VB .Net I know the following 2 methods Method 1: from MSDN http://msdn.microsoft.com/en-us/library/system.io.directory.aspx ' The following example calculates the size of a directory ' and its subdirectories, if any, and displays the total size ' in bytes. Imports System Imports System.IO Pub...

XML reading optimization .NET

Here's what I've got thus far: Dim xpDoc As New XPathDocument(strXmlUrl & strXmlInfo(0) & "?xml=1") Dim xpNav As XPathNavigator = xpDoc.CreateNavigator() Dim xpExpression(9) As XPathExpression Dim xpIter(9) As XPathNodeIterator xpExpression(0) = xpNav.Compile("/profile/steamID64") 'etc.. up to 9 For i = 0 To 9 xpIter(i) = ...

Array in VB .Net

I have an array Newstr(20) When I fill it, I need to know how many of its indexes has been filled ? and find out the values. ...

Getting Started with Matrix3D (Silverlight)

Okay, I know absolutely nothing about 3D projection, but I need to figure out a way to project pictures in Silverlight (<Matrix3D/>) based on some predetermined variables that I have available to me. I've searched high and low for some sample code or a really basic "for stupidies" set of articles, but have yet to find anything that makes...

task/activity precedences/dependencies

i am looking for some .net based library/piece of code to implement task/activity scheduling like microsoft project scheduling in following cases... Finish to Start Finish to Finish Start to Finish Start to Start please refer to understand in which context i am talking about... About linking tasks @ http://office.microsoft.com/en-us...

LINQ Generic SUM - VB.NET

Hi, I have two methods: Public Function GetTotalLimit(ByVal entity As Entity) As Int64 Return (From c In entity.Collection Select c.Limit).Sum() End Function Public Function GetTotalUsed(ByVal entity As Entity) As Int64 Return (From c In entity.Collection Select c.Used).Su...

Error in assigning object of nullable type in vb.net

Hi, I am new to VB.net and facing a strange situation. I have a structure that contains another structure. The inner structure is nullable. Now wht I do is something like the following. I create a new instance of the inner structure, set the member variables and assign the whole structure to the inner structure of the parent. But it is g...