vb.net

Write a binary file directly to the clipboard

Is it possible to write a binary file directly to the clipboard in .NET? (Rather than write it to a file and then copy it?) the file is not an executable but will be pasted to the desktop\folder for example. Dim connection As New SqlConnection("Data Source=SERVER\SQL2008;Initial Catalog=NorthPole;Integrated Security=True") Dim command A...

Splitting strings in VB.Net

Hi all! I have this code: Dim StringParts As New List(Of String)(OriginalString.Split(New Char() {"\"c}, StringSplitOptions.RemoveEmptyEntries)) When run, StringParts always have one element, because StringSplitOptions.RemoveEmptyEntries = 1. How can I tell VB.Net to use the right function, and not understand StringSplitOptions.Remo...

Can anyone spot the issue with this VB.Net code?

I'm writing some code in VB.Net which I hope demonstrate to colleagues (not to say familiarise myself a little more) with various design patterns - and I'm having an issue with the FactoryMethod Pattern. Here's my code: Namespace Patterns.Creational.FactoryMethod ''' <summary> ''' This is the Factory bit - the other classes ar...

mysql restore problem with VB.NET

Im trying to restore my mysql db from the dumpfile i have created. This is my code: Shell(My.Application.Info.DirectoryPath & "\mysql.exe" & " --user=root --database testdb < " & """" & txtRestore.Text & """") But nothing is happening; data is not being restored in the db. Please help me in this! ...

Xpath preceding-sibling (using HtmlAgilityPack and VB)

Im using HtmlAgilityPack/HAP so that I can use Xpath with HTML documents. I need help selecting the preceding-sibling of div class="address" in this url: www.yellowpages.ca/search/si-geo/1/sh/Ottawa,+ON The sibling that I want is h3 class="listingTitleLine" Here is a screenshot: http://i55.tinypic.com/25gc4qo.png Can I get some help ...

Putting forward a solution to replace Typed datasets

Hi all, A project I am currently employed with will have some time soon to improve and specialise a product that is currently in use. We may have about 4 man weeks spare in which we could replace the typed datasets that are in use. The project is currently written in Vb.Net and we will definitely not have time to replace this code with...

Modify regex code, only one line

I have this code Dim parts As New List(Of String)(Regex.Split(RichTextBox2.Text, "~\d")) That splits lines in this format into parts: ~1Hello~2~3Bye~4~5Morning~6 So if I do MsgBox(parts(5)), it will show me "Morning". I want to do the exact same thing, but now my line is arranged like this: Hello, Bye, Morning, ...

HtmlAgilityPack interfering with my code (not a HtmlAgilityPack question)

Here is a snip of my code: Dim content As String = "" Dim web As New HtmlAgilityPack.HtmlWeb Dim doc As New HtmlAgilityPack.HtmlDocument() doc.Load(WebBrowser1.DocumentStream) Dim hnc As HtmlAgilityPack.HtmlNodeCollection = doc.DocumentNode.SelectNodes("//div[@class='address']/preceding-sibling::h3[@class='listingTitleL...

Closing forms in VB.NET

Dear All, I have a small requirement and that is as follows: I have a login form and after a successful login, i open another MDI form, but i want to close the login form. I have given the code as: MDIForm1.show Me.Close This does not seem to work. Can anyone help on this. Similarly, is is possible to open the login ...

Changing CommandText changes Parameters

I'm trying to edit the CommandText for the Insert Command in a TableAdapter in the Designer in vb.net. Whenever I make changes to the CommandText, Visual Studio (2008) automagically changes the Parameters to a Collection consisting of one Parameter that existed before editing the Command, immersed in a sea of complete garbage Parameters,...

Is there any built-in function in NET Framework which encodes a string to a valid XML unicode?

After checking an Xps file i noticed that the string within the Xps file <> is converted to &lt;&gt; So is there any built-in function in the .Net framework that could do this job for me? If it does not exist what characters becides <> should i escape in myOwn function? I try to implement a search within an xps file, but searching for ...

using converters

I have to format a string ("00:10:08:10") into (10 weeks 08 days 10 hrs). So I used a converter and added it with the datagrid binding. My code: Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Wind...

Datagridview doesnt work!

Possible Duplicate: Datagridview doesnt work! I have written code to show records in a datagridview but it shows nothing. I have tried to debug & when it step into GetData function following codes Catch ex As Exception returnData = Nothing If connection.State = ConnectionState.Open Then con...

reflection retrieve private methods of a class

I want to retrieve private (implementation and other) methods of a class which implements an interface and also is derived from (inherits) a base class. How can I achieve this using reflection? Is there anyother way to achieve this? This is wat m tryin to do. I need to view these private methods and their contents, I don't want to in...

How to shutdown a locked PC (vb.net)?

Shutting down a pc in vb.net is easy: Process.Start("shutdown", "-s -t 00") unless the user has locked the pc in which case the above fails. How do I get around this in vb.net? How do I shutdown a locked PC? The program will be running locally. ...

GridView1.SelectedRow returning nothing

Hi there, My problem is that in the below code, the SelectedRow property returns nothing. I manually bind items to GridView at runtime and autogeneratecolumns and autogenerateselectbutton properties are true. I think the problem is about having a PostBack when the Select command is clicked. Thanks a lot. Protected Sub GridView1_RowCo...

Extension method and type constraints

I am starting to play with extension methods and i came across with this problem: In the next scenario i get a: "extension method has a type constraint that can never be satisfied" Public Interface IKeyedObject(Of TKey As IEquatable(Of TKey)) ReadOnly Property InstanceKey() As TKey End Interface <Extension()> _ Public Function To...

how remove all special characters(except - and /) from a string including all cr,lf,crlf, other illegal characters?

i have been trying to remove special characters. i am not able to remove many crlf in middile of the string. please help. i got this issue in production, need to resolve it soon. thanks in advance. ...

Why won't this work as an IIF function, but will as an IF Statement?

The following works: If 1=1 rdoYes.checked = True Else rdoNo.checked = True End If However, the following doesn't work: IIF(1=1, rdoYes.checked = True, rdoNo.checked = True) Why is this? Thanks! ...

VB.NET DataSet not working with view with linked SQL Server

I am in DataGrid hell right now but that's another post. Anyway, I wrote a view with a union query in SQL Server that grabs data from a linked SQL server. Anytime I try to add this object as a dataset in VB.NET it completely bombs out on me with this ugly error message... ERROR [42000] [Microsoft] [ODBC SQL Server Driver] [SQL Server]...