vb.net

Is there any way to create a windows installer package in vb.net using tools from microsoft?

I want to create a windows installer package using visual studio. It is my understanding that there was a simple way to do this in vb6, you could add an installer like you can add a new form. How can I do this in vb.net? I downloaded and installed the Windows SDK from http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-967...

Can I show an alert from Global.asax on a page that's experiencing a SQL Timeout?

In Global.asax, is there a way to handle SQL Timeouts elegantly, and display a message on the requesting page explaining the error? I know Global.asax has the Application_Error and Error events, but I'm not sure which (if any) I could use to accomplish this. Related, can I access the page instance which raised the error that Global.asa...

How do you refresh a combo box item in-place?

The ComboBox Items collection is an ObjectCollection, so of course you can store anything you want in there, but that means you don't get a Text property like you would with, say, a ListViewItem. The ComboBox displays the items by calling ToString() on each item, or using reflection if the DisplayMember property is set. My ComboBox is i...

Why can I pass a Nullable valuetype into a non nullable valuetype?

I accidently wrote some code today that was like this: Private Sub Foo() Dim i as Nullable(Of Integer) Bar(i) End Sub Private Sub Bar(myInt as Integer) ''//Do Stuff End Sub I immediately noticed the issue, but I had already hit the run button. It compiled successfully, I ran it through to the section and it threw an excep...

How Do I Create Something 'OF' a Variable's Type?

I have some code like: Lookup(Of String)("Testing") Lookup(Of Integer)("Testing") And both of those Lookups work great. What I'm trying to is call the appropriate LookUp based on the type of another variable. Something that would look like... Lookup(Of GetType(MyStringVariable))("Testing") I've tried to Google this but I'm having...

class name and method name dropdown list is missing (visual studio setting)

Does anyone know how to get my class name and method name dropdown lists again? It's the dropdown lists that are usually above the code. It's just a setting but i can't seem to find it. I don't want to reset my setting btw. I shouldn't have to. ...

Utilizing Dual/Quad core Technology

Guys, In C#, when I create a new thread and execute a process on that thread, is there a way to assign it to a particular core? Or does the operating system handle all that automatically? I wrote a multi threaded application and I just want to be sure its optimized for dual/quad core functionality. Thanks ...

Escape character in VB.NET

For displaying the character & in a button as text, i am using && I would like to display the string % in another one button but the &% does not work. So how can i display the char % By using this btn5.Text = "%" the percentage symbol is not displayed at all! ...

Aggregating parent/child tables using Linq to SQL and VB.net

I'm having a nightmare with LINQ. I've got a table of Projects, and each project has many InvoiceHeaders. The Invoice header had a field AmountNet - the value of the invoice. I want to retrive, for arguments sake, all of the fields from Projects, with the count of invoice headers and the sum of AmountNet. I.e. list of my projects, ho...

SerialPort reading cause error because of not owning thread

I have a simple WPF windows application trying to read a serial port with the System.IO.Ports.SerialPort. When I try to read the incoming data in the DataReceived event, I get an exception saying that I don't have access to the thread. How do I solve it? I have this in the WPF window class: Public WithEvents mSerialPort As New Seri...

Comparing two textbox values in vb.net

Hi, I am usingh VB.net, I have two textboxes please see below: <tr id="trCheckedBy2" runat="server"> <td> Application Checked by 1: </td> <td> <asp:TextBox ID="CheckedBy1TextBox" runat="server" Text='<%# Bind("CheckedBy1") %>' /> </td> <td> Application Checked by 2: </td> <td > <asp:TextBox I...

How do spell check to type the text for TextBox in vb.net?

I will try the way of the following code: 'Click on Button1 spell checks Text1 textbox Dim strResultText As String Dim sc As New SpellChecker sc.OpenDictionary "c:\SpellUS.lex" Private Sub Button1_Click() TextBox1.Focus() strResultText = sc.CheckText(TextBox1.Text, ExitStatus) TextBox1.Text = strResultText End Sub But The...

Can a System.AccessViolationException happen because of faulty RAM?

I have a website that i've been working on for about a year now. Recently, it's started throwing System.AccessViolationException every now and then, in my dev machine, mostly, when I was away from the machine... I haven't changed anything on the server code in weeks, since I've been working 100% on the Javascript part, and this error st...

What's the LINQ equivalent to SUM(CASE WHEN X=Y THEN 1 ELSE 0 END)?

Hello, Not sure if this is just a bad habit, or a valid way of doing things, but for large complex report queries spanning bunches of tables, I often get my aggregate stats by summing a Case statement. For example: SELECT Contact.Name, SUM(CASE WHEN Order.Type = 'Special' THEN 1 ELSE 0 END) AS SpecialOrders, SUM(CASE WHEN Orde...

Server-Side Code to Execute Based on a Time Range

We have a Try/Catch block of code in our web application to trap a certain exception. What we want to do with this exception depends on the current time. If it is between 4:30PM and 3:00AM we will want to send an email, otherwise we will throw the exception. What is the best way to accomplish this? Try 'Yada Catch ex as WebExcept...

Append to a Select Command

I have a Gridview that I want to filter. My gridview is in an update panel and my filter button is not. On button click i have the following protected void bttnfilter_Click(object sender, ImageClickEventArgs e) { if (TextBox1.Text != "") { SqlDataSource1.SelectCommand += " and field like '%' + @param + '%'"; SqlC...

DateTimePicker: Selecting a range of hours within a single day only

I'm looking for a way to use two DateTimePicker controls to select a range of hours and minutes within one day. That is, to basically select a 'starting time' and 'ending time'. I started with two DateTimePicker controls with the custom format of h:mm tt. I tried adding (on ValueChanged), a check that made the selected 'starting time' w...

WinForm CheckListBox problem with ItemCheck event

When the checked state of a check box change, I would like to know what the new value is. his is what I am doing: Friend WithEvents clstTask As System.Windows.Forms.CheckedListBox Private Sub clstTask_ItemCheck(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles clstTask.ItemCheck Dim Selecte...

Access mtehod in aspx page from the usercontrol

Hello, I have a button in my usercontrol. When that button is clicked I need to call a method thta is in aspx page. How do I do that? Thanks ...

sort filtered gridview

I have a filtered gridview in an updatepanel. I want to allow to sort filtered data. How can this be done? When I click to sort a column it reloads the entire gridview. ...