vb.net

IXmlSerializable Dictionary problem

I was trying to create a generic Dictionary that implements IXmlSerializable (credit to Charles Feduke). Here is my trial: Sub Main() Dim z As New SerializableDictionary(Of String, String) z.Add("asdf", "asd") Console.WriteLine(z.Serialize) End Sub Result: <?xml version="1.0" encoding="utf-16"?><Entry key="asdf" value="a...

How to refer to a text in an Ms Access table?

I want to refer to a data cell, which if it is equals to some string, it will do something. The codes: If ds.Tables(0).Rows(i)("Status") = "Reserved" Then MessageBox.Show("Can't reserve") End If Is this the correct way to do this? Because I failed doing so.. ...

CRC for cross platform applications

I wish to use common CRC logic in a VB.NET or C# application as well as on a C/Linux application. I have one C/Linux application that interacts with a webservice (written in C#) and also a web application (written in VB.NET). For some data, I want to add a CRC to the data itself (say a file) from the .NET side and check for the integrity...

vb.net A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

I just installed Visual Basic 2010 Express. I created a simple console application: Module Module1 Sub Main() Dim i As Integer i = 0 End Sub End Module I'm getting the following error SIX times before I get to line "i = 0": A first chance exception of type 'System.Runtime.InteropServices.COMException' occur...

C# > VB Conversion, RelayCommand behaves differently

[Visual C#] public ICommand MyCommand { get { if (this.myCommand == null) { this.myCommand = new RelayCommand(this.ShowMyCommand); } return this.myCommand; } } private void ShowMyCommand(object param) { ... } Th...

PictureBox1_Click and different image

Hi i have a special request ... I am trying to make a normal button as minimize and exit ... I want three different picture for example button with exit: 1) Stable opened window has exit_1.png 2) When you mose-over it it display exit_2.png 3) When you mouse-leave it display again standard exit_1.png 4) When you press it (click) it di...

Winforms: How to prevent vertically resize in VB.NET

Hi, Working with winforms I wonder if there is some way to prevent vertically resize of the form. I would like to allow user to resize form in all directions except vertically.Moreover I would like to allow vertically resize in upward direction, but not downward. I have tried to use maximumsize by setting it to: Me.maximumsize = new si...

How to write 2 statements that differ just by Operator type in VB.NET

Hi I have the following code sample, where the only difference between the 2 parts of the If statement is the less than/greater than operators. Is there a better way to write this? Could almost do with being able to define an Operator variable. If myVar = true Then Do While (X < Y) 'call Method A ...

Date format error in vb.net ?

I get this error when I run the application Incorrect syntax near 12, on debugging I found that this error is caused due to the # along with the date. Dim backdate as datetime backdate = DateTime.Now.AddDays(-1) on binding the data to the grid to filter the backdate records this error is caused Incorrect syntax near 12. myqry = " s...

How do I "DoEvents" in WPF?

I've read that the C# version is as follows: Application.Current.Dispatcher.Invoke( DispatcherPriority.Background, new Action(delegate { })); However I cannot figure out how to put the empty delegate into VB.NET, as VB.NET does not appear to support anonymous methods. Ideas? Edit: Possibly this? Application.Cur...

How to register a VB.Net User Control with jQuery

Greetings and thank you in advance for the help. I created a user control in VB.NET that uses a jQuery datepicker. I am at an impasse. The code I have works for one datepicker control on the page but because I can only register the client script once, it will not work for multiple instances/datepickers on the same page. What is the b...

Printing an external file in its own printing routine

I basically have an application that generates reports in a .html file, I use a .html file for the ease of making tables and formatting text. Now I would like to introduce a way of printing the reports from my program. Because I use a .html file, the formatting would not the correct if I was to print it directly from my application (as ...

OutofMemory Exception Dropdownlist when autopostback=true

I have a master page than contains my ScriptManager. On a child page i have an updated panel. Inside the update panel there is a dropdowlist. When i set the autopostback=true i get OutofMemory Exceptions. All the time. Please also note that I have AjaxControlToolkit set on my web.config. Here is parts of my Code. MasterPage.aspx <ajax...

How do I use "Into" LINQ expression in VB.NET?

I'm converting from C# this LINQ expression. However, it does not seem to work. C# return (from w in fishSticks group w by w.FishQty into g orderby g.Key descending select g).First().First(); VB Return (From w In fishSticks Group w By w.FishQty Into g() Order By g.Key Descending Se...

"Inline" function call: function is never hit

Hi everybody. I'm trying to make a tabbed menu for the asp.net website I'm working on. One of the pre-requisite is obviously to color the current tab differently, so the user can know on which tab is currently is. To do this, I made this method in my code-behind: Protected Function GetCssClass(ByVal ctrl As LinkButton) As String ...

Convert C# format to VB

I am sure this is a simple question for you guys but I don't know what this developer is doing. name = String.Format(MyStringBuilder + ""); If I convert this to VB I get the message "operator + is not defined for types system.text.stringbuilder and string". Same thing if I use &. ...

Calling VB.NET code from Excel

I open an Excel workbook from VB.Net and then want an event in the workbook (such as pressing a button) to activate code in VB.Net. How do I accomplish this type of callback? ...

MailMessage, difference between Sender and From properties

I've been using the System.Net namespace ever since we switched from .net Framework 1.1 to the 3.5 framework, but there's one thing that's been puzzling me since. What's the difference between the Sender and the From properties in the MailMessage class? Are they both the same, and if not is there a reason to use Sender together with Fr...

Dispose Form opened in MainForm tab

Hi, I have a MainForm which has tab Control and several independent form. I open each Individual From in the tab of the main form. A "Close Tab" button on the MainFrom closes the current tab, its implementation is below. This closes the current tab but what I also need is to dispose the From whose tab is closed but I am not sure how to ...

LINQ to SQL get grouped MIN with JOIN

I'm having trouble with a LINQ to SQL query getting the min value using Visual Basic. Here's the SQL: SELECT RC.AssetID, MIN(RC.RecCode) AS RecCode, JA.EngineerNote from JobAssetRecCode RC JOIN JobAssets JA ON JA.AssetID = RC.AssetID AND JA.JobID = RC.JobID WHERE RC.InspState = 2 AND RC.RecCode > 0 AND RC.JobID = @JobID GROUP BY RC.Asse...