vb.net

Dynamically Add Div Table Rows in VB.NET

Hi, Im a VB.NET beginnger, can anyone tell me how I can dynamically add a div table row or how I can loop a section of html? thanks. ...

how can I tell if someone printed from printPreview?

Using printPreview As New PrintPreviewDialog() ' Dim x As New Printing.PrintDocument() ' AddHandler x.PrintPage, AddressOf PrintData printPreview.Document = Me.CurrentDocument If ShowPrinterSetup Then Dim x As New PrintDialog() x.Document = CurrentDocument x.ShowDialog(A...

ASP.NET Insert <% =i %> into ....

How can I append this <% =i %> variable onto this. <asp:DropDownList ID="AdTitle" runat="server"> Cant have this for some reason. <asp:DropDownList ID="AdTitle<% =i %>" runat="server"> ...

Correctly matching an ending tag with its starting tag in HTML with a RegEx

I'm using VB.Net in an ASP.Net 2.0 app to run some regular expressions that remove some unnecessary markup. One of the things that I'd like to do is remove span elements that don't have any attributes in them: output = Regex.Replace(output, "<span\s*>(?<Text>.*?)</span>" & styleRegex, "${Text}", RegexOptions.Compiled Or RegexOptions.Cul...

VB.NET Repeater Simple Data Binding Without Datasource

I've got a form that has to be a repeater on a webpage. I have a number parameter that tells me how many additional customer details are to be added. In this page I have a repeater control that needs to repeat items a set number of times. For each item there is a set of input boxes that needs an id appended to it. All I need to bind is a...

Question about Type Comparison ASP.NET and DBNull

I have a function that pulls articles records from an MSSQL database. Some are URLs to PDFs, and other are actual articles stored in the SQL. The articles that are stored do not have a URL (DBNull) in the record, so I want to be able to parse that. I tried a simple test: If Row.Item("url").GetType Is GetType(DBNull) Then //' do some...

Problem with StringBuilder and XML Literals

I'm having a problem using XML literals with a StringBuilder in VB 2008. If I use this code everything is fine. Dim html As New System.Text.StringBuilder html.Append(<html><body></body></html>) MsgBox("hello") Now the problem is I want to wrap HTML around something that is generated in code. html.Append(<html><body>) msgbox("nothi...

Problems importing database from vb.net

I’m trying to import a table into a secured sql database using vb.net but it seems to timeout (or so I think) and not import properly (null value), I truncate the table to save the field types and then call the shell() function to import the file and 'Clean out the existing data in the validation import table cmd.CommandText = "TRUNCAT...

Showing a form from a webpage

I have a problem I am trying to solve in an elegant manner. I have a .net application that I have created. I am trying to get one of the forms to be shown from a webpage. This sounds strange I'll admit, so here is the backstory We have some large monitors at work, that show information on them. I have no control over how the information...

asp.net unhandled exception

I have an application that has been running in produciton for a while now, and every now and then it throws an akward exception that I catch in the global.asax session error event. This procedure sends an email out with the error message, source, and stack of the error, and that is usually sufficient information for us to find the proble...

Why Encoding.Default.GetBytes() returns different results in VB.NET and C#?

We recently came across some sample code from a vendor for hashing a secret key for a web service call, their sample was in VB.NET which we converted to C#. This caused the hashing to produce different input. It turns out the way they were generating the key for the encryption was by converting a char array to a string and back to a by...

get selected row index of dynamic dropdown list selection

I know the question is a little choppy and perhaps misleading,but I have a gridview with dropdownlists on the rows. I created an AddHandler and a Delegate for the SelectedIndexChanged and it gets to the sub. Here is the code for that: AddHandler ddlmgr.SelectedIndexChanged, AddressOf ddlmgr_SelectedIndexChanged Public Delegate Sub DropD...

Run a method on all objects within a collection

So I have a collection of Razzies created from a Collection of Bloops. I retrieve this collection using a Linq query. Reference:http://stackoverflow.com/questions/923238/linq-select-certain-properties-into-another-object for the query. I would like to know if it is possible to run a method on all of the newly created Razzies before re...

Serializable partial classes

Guys, I have the follow VB.NET class definition: <Serializable()> Partial Public Class Customers End Class Inside another file I have the same thing (with different methods and variables of course). When I compile, I get the following error: Attribute 'SerializableAttribute' cannot be applied multiple times. The error is pretty self...

Does VB.NET perform any multi-threading on its own?

I know .Net and C# pretty well, but never even looked at VB. My problem is: our Win32 COM library is used by a number of clients, and we see that the number of failures is higher for those who use the library from VB (both VB and VB.NET) than for those who use C++, C# or Delphi. One thing about our library is that it is supposed to be u...

How do I specify the equivalent of volatile in VB.net?

I'm attempting to write a lock-free version of a call queue I use for message passing. This is not for anything serious, just to learn about threading. I'm relatively sure my code is correct, except if the instructions are re-ordered or done in registers. I know I can use memory barriers to stop re-ordering, but how can I ensure values ...

What options to I have to pass a value between two asp.net pages

I want to know what the best practice is for passing values (sometimes multiple values) between two asp.net pages In the past I have used query strings to pass a value in asp like this: href='<%# Eval("TestID","../Net/TestPage.aspx?TestID={0}") %>'><%#Eval("Title")%> </a> I assume you can do this in the code behind but I do not know ...

Is there a way to build a new type during Runtime?

I am going to ask a question that might sound weird. Is there a way to build a new class during Runtime? Or at least, add a new property to an existing class. I mean creating a class that doesn't exist and not an instance of an existing class. I could later on use reflections to load and use this class. ...

How do I download a webpage into a stream in .NET

I know this should be a basic question but I am hitting a brick wall. I am looking to go to a URL/URI download the resulting string as if I had opened a file and then get it out into a String variable. I have been stuffing about with IO.Stream and Net.httpxxx but haven't managed to get the elements to line up in the right way. I get "t...

vb.net calling a sub routine on a user control

I am very new to development and I have a question about my user controls. I have a panel2 inside a split container that has several user controls loaded into it. Panel 1 has an exit button and I want to call one of the sub routines that is in one of the user controls loaded into Panel2. Private Sub btnExit_Click(ByVal sender As Syste...