vb.net

when is it ok to use a structure rather than a class

In a recent project I was working I created a structure in my class to solve a problem I was having, as a colleague was looking over my shoulder he looked derisively at the structure and said "move it into a class". I didn't have any argument for not moving it into a class other than I only need it in this class but this kind of falls ...

How can I work around the __Canon type problem in generic exception handlers?

Given an extension method like this: Public Sub RehydrateTo(Of T As New)(ByVal input As String, ByRef output As T) Dim ms As MemoryStream = MsFromString(input) Dim f As New DataContractSerializer(GetType(T)) Try output = CType(f.ReadObject(ms), T) Catch ex As SerializationException output = New T Dim ild ...

Irda + vb.net express

Hi Not sure that this is a valid programming question ... but is it possible to program infa red using vb.net express (iRDA) Got a programming project in my mind, but none of the coding examples work, IrDAClient never gets recognised Cheers ...

Disabling Scroll with System.Console.Write

Is it possible to use Console.Write to place a single character at the very bottom right of a typical 80x25 console, without having the console scroll the row up? This is the code that I'm using... Imports System Console.SetCursorPosition(Console.WindowWidth-1, Console.WindowHeight-1) Console.Write("x") This is not working like I woul...

Efficient way to create a class from a datagridview data.

Is there an alternative to load data from a datagridview into a class than to iterate through the datagridview? ...

Inserting,updating,deleting data from and to excel files using oled or odbc connection

I have tried everything.but im not able to insert updat and delete the excel file..im able to connect the excel sheet.the connection also seems to be opened...here s my connection string: Dim sConnectionString As String Const kunal = "C:\" sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Sou...

User control - calling a vb linkbutton's(within a user control) click event from javascript

how can i call a VB function - deleteevent() in usercontrol.ascx.vb from a javascript function in clickhandler(e) in usercontrol.ascx. The call should cause a postback because i need the usercontrol to display the changes. i am currently trying to do it by using a linkbutton with style display:none, and calling its click event from the ...

File Upload link clears when page reloads, why?

I am using ASP.net(2.0) with VB.NET. I have a User registration form. On that form the user supply all his contact details and he can upload a image with the normal file upload control in ASP.net. This is my problem. If anything goes wrong on the page then i give the User a error message saying what he left out or what went wrong. But ...

Best way to create a folder and upload a image to that folder in ASP.NET?

Hi Any code examples on how i must go about creating a folder say "pics" in my root and then upload a images from the file upload control in into that "pics" folder? If you don't want to give me all the code, i will be happy with a nice link also to show me how this will be done in VB.NET (C# is also ok). Thanks in advanced!!! ...

Serializable Class Collections

I have a class that contains a list of properties which serializes just fine. However I need one of those properties to contain a collection of another class to give me sub classes Example XML <VideoOptions> <property1>value1</property1> <property2>value2</property2> <property3> <item> <property1>value1</property1> </item> <item> ...

Is there a better way of filling a generic List from a SQL DataAdapter?

I have an existing application that uses Active Record for its data retrieval. It's in VB.NET (first time I'm doing VB.NET; I usually work in C#). And I'm building a method to return a List(Of T) of an object. The current pattern uses a SQLDataAdapter to populate a datatable. I COULD add the record to the List(Of T) as I fill the datat...

Using two .NET libraries with the same namespace

I'm currently maintaining some old code for a company. As it would happen, the current app I'm modifying uses an older version of the in-house library (we'll call this Lib1.dll). They also have a new version of the library called Lib2.dll that improves upon the previous library in many ways. Unfortunately, Lib2 is not backward compati...

Place Pencil in row header of last datagridview line before entering data

Hi, I am coding in Visual Basic Express 2008. I have 2 forms in the solution. Form 1 is the main form and form 2 is the child. The child form being displayed after using a button with the code "Form2.ShowDialoge" I want to select the new row in the datagridview on Form 1 and populate it with data from form 2 without typing on the ne...

VB.NET: What is the best way to retrieve a value from a second form?

I'm teaching myself VB.Net. Here is a problem I have recently come across. Say I have a main Form1 in my application. Form1 calls a second LoginForm which (like the name suggests) is a login window with username/password type fields. Expected behaviour is that LoginForm will capture login details and pass them back to Form1. What is th...

Need help converting VB.NET 08 code to PHP - Getting direct link from MediaFire.com

Hello! I was looking for a way to get a direct link from mediafire's file hosting service. By default, when a user visits a download link, he will be presented with a download page where he has to wait for the download to be processed and then a link will appear. This link will appear in the div id 'download_link'. I googled and found ...

Something wrong with my GridView code...

this code never fills the grid view I know that somthing is wrong here the code Imports System.Data Imports ZidduDataSetTableAdapters Partial Class _Default Inherits System.Web.UI.Page Dim filesAdp As New FilesTableAdapter Dim filestable As New ZidduDataSet.FilesDataTable Protected Sub btnfill_Click(ByVal sender As Objec...

Createinstance() - Am I doing this right?

I'm trying to put together a plugins system with .NET, and I'm not sure if I'm doing it correctly. The basis of the system is that a specific directory ({apppath}/Plugins/) will have a bunch of precompiled DLLs, and I want to look through each one with reflection, and for every class available, if it inherits a specific base class (this...

adapter.update

i make the adapter.insert and the adapter.delete and both work good but not with the adapter.delete even i put only on argument here the code Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click usersAdp.Fill(userstable) usersAdp.Update(txtid.Text, Me.txtname.Text, Me.txt...

Calling a vb linkbutton’s(within a user control) click event from javascript

how can i call a VB function - deleteevent() in usercontrol.ascx.vb from a javascript function in clickhandler(e) in usercontrol.ascx. The call should cause a postback because i need the usercontrol to display the changes. i am currently trying to do it by using a linkbutton with style display:none, and calling its click event from the ...

Selective resource compiling in .NET?

How can I choose which resources to compile depending of the compile constants used? So, if VAR1=0 then I wouldn't add RESOURCE_A to my final assembly. I searched around, but didn't find any info regarding this... I guess I'm using the wrong keywords, since I doubt nobody else had this problem/doubt ever before. Also, I use both VS2005...