vb.net

How to define the ActionLink in VB.NET ?

ActionLinks This Image shows type-safe method of defining the Actionlinks ,how to define it in VB.NET ...

How can I scroll an ASP.NET page under control of the code-behind page?

I have an ASP.NET 3.5 page with some AJAX, some Validators and some business-rule validation done in the code-behind page (VB.NET). The Validators set focus to the 'offending' control when an error is detected. When a business rule is violated, I used the following code to generate some javascript "on the fly" and execute it to simul...

Problem with Unit test and SQL database Connection

I am having a problem with a unit test I have created. First time doing this so I am not sure why I am getting this error <DeploymentItem("ETDS.exe")> <DataSource("System.Data.SqlClient", "Data Source=Foo;Initial Catalog=FooDB;Integrated Security=True", "User_Names", DataAccessMethod.Sequential)> <TestMethod()> _ Public Sub ValidateUser...

My asp.net control loses its property values?

Hello, I'm writing a custom user control for my asp.net site, for storing datetimes. It has two properties: Private _includeTime As Boolean Private _value As DateTime = Nothing Public Property IncludeTime() As Boolean Get Return _includeTime End Get Set(ByVal value As Boolean) ...

Parser Error(could not read state "obj\Debug\ResolveAssemblyReference.cache) while loading an asp.net page

Hi,i got an error while loading a page in asp.net.I have renamed the page before loading it.The error is as follows:- **could not read state "obj\Debug\ResolveAssemblyReference.cache"** Please help ...

To increase the timeout period

hi guys, I have to increase timeout period.Following is my code. Private Function GetConnectionInstance() As SqlConnection Dim objConn As SqlConnection Dim strConnection As String strConnection = ConfigurationSettings.AppSettings("conn") Try objConn = New SqlConnection(strConnection) Catch ex As Exception ...

Setting expectations on Sub (not Function) in VB.NET using Rhino Mocks

I remember that to set expectations on methods that return void in C# one has to write: mockedRepository.Expect(() => mr.AddUser(someUser)).DoOtherStuff() where AddUser returns void. How to achieve the same in VB.NET? EDIT: I've found similar question. May be helpful: How to mock a method with Rhino Mocks in VB.NET . ...

Run Time Error

hi Experts, Can anyone pls throw light on this error ? An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in STUB_CREATOR.exe Additional information: Exception from HRESULT: 0x800A0036 (CTL_E_BADFILEMODE) This is the line that creates the error Dim f As New Scripting.FileSystemObject starter = f.O...

Cannot select from a datagrid using javascript in Morzilla,IE8

hi.... In a form(File.aspx) i am generating another popup window (Lookup.aspx including a DataGrid). From that datagrid i can fill the textbox in File.aspx using javascript.It works in InternetExplorer7 & InternetExplorer8 .But in Morzilla the popup & datagrid is appearing,but i can't select from datagrid . In same manner a calendar ...

Is it possible to write a generic function in .NET that only accepts numerical types?

Suppose I want to write a function like the following (as usual, a trivial example for illustrative purposes): Public Function calcSqSum(Of T)(ByVal list As IEnumerable(Of T)) As T Dim sumSq As T For Each item As T In list sumSq += (item * item) Next Return sumSq End Function As you can probably guess, this f...

Using a custom type in a LINQ query

If you have custom type, and you wish to assign a List(of T) to that custom type, how do you do so in vb? I found a C# example as below List<myclass> result = (from c in db.Customers where c.orders.count > 1 Select new Myclass { Id = c.customerID, Name = c.contactname }).Tolist(); From this site http://blogs.msdn.com/swiss_dpe_team/a...

Good book with C# *and* VB examples?

I'm teaching some .Net classes and want to give the students some good books to read during and after the class. Some will prefer VB and other will like C# so the books need to give examples in both languages. I need one book each for these classes: Intro to .Net (Windows apps and ASP.NET together) Intermediate/advanced Windows apps ...

Highlight text in .NET, .Select() isn't available

I have a Web Forms textbox in a gridview and I want to higlight the text on a button click. textbox.select(start,end) doesn't work. Here is the code: Dim row As GridViewRow = TryCast(DirectCast(sender, ImageButton).Parent.Parent, GridViewRow) Dim txtdays As TextBox = row.Cells(2).FindControl("txtDays") Dim lbldays As Label =...

using axspreadsheet in vb.net

hello, i am having an awful time with axspreadsheet for vb.net 2008. the simplest example is i just add the control to the form. it compiles on one computer, but it doesnt compile on any other computer. i may be missing a reference or a prerequisite but i have searched for about 10 hours, and i have not gotten any insight into this. than...

Is it possible to do a For...Each Loop Backwards?

I don't believe this is possible by conventional methods, but something like this verbose code: For Each s As String In myStringList Step -1 //' Do stuff here Next I will probably have to invert the myString object before a conventional For..Each Loop, correct? ...

SqlBulkCopy not working in VB.NET

This code giving me fits. Returns the error: The given ColumnName 'COURSENAME' does not match up with any column in data source. If I remove the mappings, nothing gets written to the db either. Help! Dim connectionString As String = "Data Source=2UA72518QY\SQLEXPRESS;Integrated Security=True;Pooling=False;Initial Catalog='Foo_Con...

How to get Text Field rotation with iTextSharp

What I need to do is query an iTextSharp AcroField to check if it is rotated, and if so capture the value of the rotation. So If I have the following field: Dim af As iTextSharp.text.pdf.AcroFields = stamper.AcroFields Dim afi As iTextSharp.text.pdf.AcroFields.Item afi = af.GetFieldItem("fieldName") What do I need to do to get the ...

Problem with long delays in .msi file.

I have a fairly simple desktop application that uses a .NET setup project (.msi file) to perform the installation. On the first installation, everything proceeds in a timely fashion with good feedback for the user. The problem occurs when the user is installing the latest version of the application over an old version on their machine....

How do I set the a specific row or cell in a gridview (vb 2008)

I know this will be easy, but I can't seem to find it anywhere. How do you SET the current row in a gridview? I find tons of ways to get data from it, but I what to set a current row or cell programatically. I'm using VB 2008 express. I also find lots of promising properties like Selected... but these are all read only and i can't se...

Problems building a VB.NET 2008 express project referencing a dll

I have written a program in VB.NET 2008 Express that references a .NET managed dll. I simply added a reference to the dll to the project. I then 'Imports' the dll at the beginning of the program and then can use it. Everything works fine when I am running the program in debug mode (and it uses the dll as intended), but as soon as I go to...