vb.net

Get day from the given date

Using VB.Net 2005 I want to get a day for the date. My Datepicker format is Custom Format (dd/MM/yyyy) Code. Dim dt As New DateTime() dt = Format(textdate.Text, "dd/MM/yyyy") textday.Text = dt.DayOfWeek.ToString When i try to run the above code, it was taking only this format(MM/dd/yyyy) Suppose Date - 02/05/2010 It should disp...

How to use if condtion

Using VB.Net and SQL Server I want to compare the textbox value with table row value by using if condition Code If textbox1.text = cmd cmd = New SqlCommand("Select name from table1", con) Then cmd.ExecuteNonQuery() cmd = SqlCommand The above code is showing error in if condition. I don't know how to compare the textbox value with t...

-How to get the currency rate from the web service-

Hiyee,I was trying to use the web service for currency rate to get the rate, althought I have already add web reference to["http://www.webservicex.net/CurrencyConvertor.asmx"] but I still do not know how to retrieve it from there. I'm using asp.net vb. Thanks!... ...

How to use C# class in VB.NET project in windows application?

I wanna use the C# code file in VB.Net project Which is windows based application. But that C# class is not using in VB.NET application. How Can I perform this task. Thanks ...

Sample code for POST + cookie?

Hello, I've been googling for some VB.Net code to authenticate to a web server with the POST method, receive a session ID in a cookie, and then send this cookie along with all GET queries... but all I found is half-working code or C# code, ie. difficult to use for a VB.Net newbie. Would someone have some code handy or some pointer that...

ASP.net 3.5 Send Web Page e-mail

Hi there, I need a source code in C# or VB to send a web Page (inside a div) by e-mail, is it secure? Thanks in advance ...

What does "Return Not (s Is Nothing)" return

Can someone explain me the behaviour of the following line in VB Return Not (s Is Nothing) I am looking to translate this in C# and i am not sure about those negation and do not understand the conditions. ...

Import query results into tool through VB.NET

I am writing a tool to import a database query results into Excel in VB.NET I tried the following code. It is not working. With objApp.ActiveSheet.QueryTables.Add(Connection:="ODBC;DSN=Build_statistics;", _ Destination:=objApp.Range("G15")) .CommandText = "SELECT * from mytable" .Name = "Query" .FieldNames...

How to get number from a string

I would like to get number from a string eg: My123number gives 123 Similarly varchar(32) gives 32 etc Thanks in Advance. ...

Generics in VB.NET

Now, as a C# programmer, I know that generics are awesome. However, when dabbling in some VB.NET, I discovered that the following does not cause a compiler error: Dim instance As List(Of Integer) instance.Add(True) Why is this? I know that you are not required to cast in VB.NET, but I'd have thought that this kills the main reason to...

SendKeys.Send("{HOME}"), vb.net

I am using SendKeys.Send("{HOME}") in a MaskedTextBox to bring the cursor to the beginning of the textbox when the text is empty. When I try to close the project the application freezes if it doesn't have focus. How do I put this application in focus before I call SendKeys? Public Class Form1 Private Sub MaskedTextBox1_GotFocus(ByVa...

RemoveHandlers on the base form

I wonder if I can remove all added event handlers in all the child forms from the one base form in the Closing method. (VB.NET; .NET 2.0) Background: In a project I analyze a memory problem. I verified with the memory profile (see related question) and find out that some forms are not collected by the GC, probably because of the EventH...

How to stop a external executable in VB.NET?

I am developping a Windows Service in Visual Basic, witch will start an *.exe when starting. It's working pretty fine. Now how can I stop this *.exe while stopping this windows service? My code is as below: Public Class MyWinService Dim RetVal Protected Overrides Sub OnStart(ByVal args() As String) EventLog.WriteEntry("MyService Sta...

Using Extension Methods from within an Object's constructor where "Me" is the ByRef target object.

Consider the following: Public Module Extensions <Extension()> _ Public Sub Initialize(ByRef Target as SomeClass, ByVal SomeParam as Something ) ... Target = SomethingElse end Sub End Module Class SomeClass ... sub New(ByVal SomeParam as Something ) Me.Initialize(SomeParam) end sub sub ...

Projectile Motion in VB

What I'm trying to do is simulate projectile motion in Visual Basic using Visual Studio. Essentially, something like this but without air resistance or mass. Anyhow, the way I'm doing it is using a PictureBox and drawing the image in (of, say, a circle) every so often with a timer of interval 1 with its x and y properties being variabl...

iframe auto resize in aspx files with vb.net codebehind

I put in the iframe tag as follows in my .aspx page - Now what code do i put in javascript or vb.net to make this auto resizable depending on the size of the page that comes in? ...

vb.net program that generates code and copy it to clipboard

I'm planning to create a vb.net program that generates mysql codes. Is is possible that after the program has generated the code, it will copy it in to the clipboard immediately? ...

Opening an MS-Cash Drawer, Wrong Code? Bad Code?

Humbling expierence here and I think this one will make a fool of me, but...I'm trying to convert an ancient cash register program to .net. Conquered everything else, but I can't pop open the cash register. Its connected to COM1, you are supposed to send a "trigger" text down COM1 that will cause the register to open. Here is the .net c...

How to auto increment the date value in vb.net?

How to auto increment the date value in vb.net? Name - asdf From Date - 23/02/2009 To Date - 12/03/2009 From Date and To Date is Datepicker column When i click the add Button, from Date should display in the textbox, then again i click the add button the next date should display in the textbox. The date should increment upto To Date...

vb.net. How do I bind dataset to DataRepeater?

I am looking for a vb.net example of how to bind a dataset/datatable to data repeater and have the data elements bound to the columns of the dataset/datatable? Thanks ...