vb.net

VB.NET problem converting DataTable to JSON

Ok so I'm trying to use the JavaScriptSerializer to work with this code. However it crashes when it reaches the last line; Dim json As New String(sr.Serialize(dt)) I get this error message; A circular reference was detected while serializing an object of type 'System.Reflection.Module'. I would really appreciate any insights...

Data Bound listbox selectedindex always -1

I've got a simple upload form. Here's my code: <form id="Form1" method="post" enctype="multipart/form-data" runat="server" <asp:label id="lblMsg" runat="server" CssClass="msg" /> <span class="msg">Select Gallery:</span> <asp:listbox id="gallerySelect" runat="server" Rows="1" DataTextField="galleryName" DataValueField="galler...

how to kill a process in vb.net

I've launched wampserver using vb.net when the application loads. My problem is, how do I kill the wamp server process when I exit the program. ...

Execute a line of code when the user clicks on the close button in vb.net

I have this code that tries to kill the wampmanager process when the user press on a button. But how can I achieve the same thing if the user clicks on the close button. Is it possible to execute a small line of code just when the user clicks on the close button? If you know any alternatives in achieving this, please do tell. thanks ...

Can't store a korean string in database using LINQ

I'm using this code to store korean string in my database: Dim username As String = Request.QueryString.Get("Some Korean String") Using dg As New DataContext() Dim newfriend As New FriendsTable With {.AskingUser = User.Identity.Name, .BeingAskedUser = username, .Pending = True} dg.FriendsTables.InsertOnSubmit(newfriend) dg.SubmitChanges...

How to Redirect from Http to Https in Intranet?

Hi, I have a vb.net application running as intranet on Win Server 2003. So should I use HTTPS instead of HTTP? What is the difference or why should I if the answer is HTTPS? Is there any code in VB to redirect from HTTP to HTTPS? Thanking you all in advance for your time and consideration. ...

Texture coordinate mapping how to map coordinates of 4 triangles in a square to 4 triangles in a triangle

Given the image below 1. I have updated the image based on feedback from Steven_W so there are 4 triangles in the right hand diagram instead of 3 which makes more sense! 2. update image again to label sub triangles as A, B, C, D in grey What is the pseudo algorithm for mapping a coordinate (x,y) in the left hand square such that a c...

Expression Expected

Im getting a build error with the following code... Private Property GridViewSortDirection() As String Get Return If(TryCast(ViewState("SortDirection"), String), "ASC") End Get Set(ByVal value As String) ViewState("SortDirection") = value End Set End Property It is happening on the following line... ...

How to identify subtriangle within a rectangle given a coordinate in that rectangle

Given a rectangle of width w and height h. and a coordinate x,y in that rectangle I would like to identify which triangle I am within. i.e. the function should take parameters(x,y) and return a,b,c,d or a zero based number representing that triangle index i.e. (0=A,1=B,2=C,3=D) if they are in that order. I think this would be somethi...

Getting click events from buttons in a control array

Using VB 2008 Express. Attaching code to buttons when they're clicked is easy when they're static buttons on the form; just double click the button on the form designer and add code to the event. I have a series of buttons that are generated in a control array, so they're generated in a class, and in the form there are no buttons until...

VBScript Out of String space

I got the following code to capture information for files on a specified drive, I ran the script againts a 600 GB hard drive on one of our servers and after a while I get the error Out of String space; "Join". Line 34, Char 2 For this code, file script.vbs: Option Explicit Dim objFS, objFld Dim objArgs Dim strFolder, strDest...

Multiassignment in VB like in C-Style languages

Is there a way to perform this in VB.NET like in the C-Style languages: struct Thickness { double _Left; double _Right; double _Top; double _Bottom; public Thickness(double uniformLength) { this._Left = this._Right = this._Top = this._Bottom = uniformLength; } } ...

Local Databases in .Net

Good Afternoon, I am looking to add a local database file (.sdf) into my .Net Project, so i go right click on my project, click "Add" -> "New Item", select "Local Database" and rename it to what i want. I then click the "Add" button and get the following error "The data provider required to connect to the local data file could not be f...

Reading XML from document with VB.net

I want to be able to read my XML document but I am a little lost how to. I cant really post my XML on here because it is just trying to use markup. Anyways, I have a root node that surrounds the whole object i want to read. From there, there are a few elements. 2 of those elements can have multiple instances. There will only be one objec...

Custom Formatting Double

I have a DataGridView bound to a DataTable in a DataSet. I set all columns of the DataTable to System.Double. I want the last row of the DataGridView to display "PASS" or "FAIL" depending on some condition of the values in that column. How do I do this? Ideas: lastCell = IIF(condition, Double.PositiveInfinity, Double.NegativeInfinit...

subsonic Invalid cast from System.Int32 to System.Byte[]

Subsonic 2.2 is throwing the error subsonic Invalid cast from System.Int32 to System.Byte[] When I do the following If template.Content Is Nothing Then MsgBox("Blank Document") Else MsgBox("Document Present") End If "template" is a SubSonic object of which it's "content" field is of t...

Dynamically Adding items to an un-order list in asp.net

if i create a html ul. and wanted to dynamically add list items to this list. so i have : <ul id="test" runat="server"> </ul> is there a way i can add list item to this list dynamically in asp.net i am using vb ...

parse onclick links in html

I certain html page contains links that are displayed with each onclick event. I am unable to parse the html for the url that will follow these onlick links. If this is the source on the page, how do I capture the content that each onclick link displays. In other words for example: <a href="#" onClick="SelGenre('001'); return false;">プラ...

add number to date field in vb.net

i have 2 fields in the database (sql server 08) Dob = "05/09/1965" license_age = 16 how do i get the number of years this person hs had licence. so basically dim age1 = current year - (dob - license_age) thanks -- thanks for the answers. worked perfectly. another question based on this. how do i find out which year he got his license ba...

Sending a complex object as parameter to Asp.Net PageMethod

I am trying to send an object created in JavaScript to an ASP.NET PageMethod. This object mirrors the properties of an existing custom business object, so i was hoping that i could pass a single object instead of a parameter for each property. I am getting an error "Unknown web method SavePart when attempting to use this method. Javasc...