Search results for query: *

  1. M

    Downloading a file

    If you want to read from Excel you'll first need to import this .NET framework library: Try this example code to get you going: Public Shared Sub Test() Dim row, col As Int32 Dim cellref, val As String 'create excel application and hide it Dim ex As Application = New...
  2. M

    BackgroundWorker & Exceptions

    Hey all, another day, another stupid .NET problem.. :D Ive got a BackgroundWorker which imports data from an Access file and does a chunk of validation on it. I throw one of a variety of custom exceptions if the data is invalid. When I run in debug mode, I always get a break in execution and an...
  3. M

    For Loops

    Sorry guys, should've spent more time googling first.. Turns out it was never there before - but in the advent of VB.NET 2005 it has finally arrived in the form of: Continue [For/Do/While]
  4. M

    For Loops

    Ok maybe a stupid question, but in VB can you force a For loop onto the next iteration? Like continue in Java/C. We've got Exit For which is the same as break, but im looking to optimise a loop with a continue type statement. Cheers guys
  5. M

    File in use by another process

    I had to write a tool for novice users to recompile a project and copy a DLL to a remote server. Basically, they use a handbook/guide to add new DataSet objects to a project and then use this tool to recompile and release an updated file. It's a bit too much power in the hands of novices if you...
  6. M

    IsUpperCase Method

    Don't think so my friend, it's an easy beast to write however: Public Shared Function IsUpper(ByVal s As String) As Boolean Dim c As Char For Each c In s.ToCharArray If Char.IsLower(c) Then Return False Next Return True End Function
  7. M

    Bringing up Outlook's New Message Dialog

    I use Office automation for a similar kind of task. Add a reference to this DLL: And here's some example code for connecting to Outlook and creating a new email with an attachment: 'create application Dim oOutlook As New ApplicationClass() 'connect to current namespace Dim oNamespace As...
  8. M

    Get arguments passed to WinForms exe

    Hey guys, is there a way to get command line arguments passed to a windows forms app? Basically i have a small updater application which reads some stuff to do from a config file and then displays a nice progress bar while it does it. It would be nice to start this updater from another...
  9. M

    Uploading Blobs

    The code there seems a bit wrong really: Dim data2 As Stream = html2.OpenRead(txtURL.Text & "?id=" & id) Dim data AsNew SqlClient.SqlParameter("@data", data2) So what youre doing is trying to insert a Stream directly into the DB - which really isnt going to work. I think you will need to...
  10. M

    Sending Structure across .net sockets

    Try declaring your structure as Serializable: <Serializable> _ Private Structure bob public egg as int32 End Structure The have a look at the example shown in MSDN on the SerializableAttribute Class section - this shows how to serialize an object down to a Stream using the SoapFormatter...
  11. M

    The best way to END a thread?

    Although I have never been taught threading in .NET, my experience of threading basics comes from Java, where the principles should be the same. The correct way to end the thread to allow the method to expire on it's own. So in your case, when the LoadAccount method ends, the thread will end...
  12. M

    Convert wave file to Mp3 file

    You could do this by starting an external process with the Lame MP3 encoder. The Lame EXE can be downloaded here (found a quick link): http://www.trudyholler.com/extras/razor/lame/lame-3.92.zip And here's the full list of command line switches you can pass to the encoder...
  13. M

    Refering To Objects By Strings

    Hehe nice vis - I do always seem to find the hard way of doing things first.. ;)
  14. M

    Refering To Objects By Strings

    If you really want to create an object from a text string, you can do it using some reflection code. For example, the following code will create a custom DataSet object which is found in a project called 'AssemblyName'. First you retrieve the Type of the object (the True indicates to throw an...
  15. M

    Access Project Resources via Code

    Cool thanks guys - Ive a slightly separate question which didnt get answered in another thread but has popped up again here: Im guessing the My namespace is a VB.NET only thing, so if im coding C# how would I do the same thing? Using the (slightly) more complicated Reflection? If so, im...
  16. M

    Access Project Resources via Code

    Hey all, You can add image resources to a project via the Resources tab in the project properties, but is there a way to access these images via code?? Currently im loading some images by path using Image.FromFile() - so it would be neater to use the project resource lib. Cheers mafro
  17. M

    Network Unavailable

    VB Only? This My. namespace is VisualBasic only? Its a nice solution, but id like something thats universal for C# and VB.NET really. :) Perhaps handling a Try..Catch around all network access is the most appropriate way to go...
  18. M

    Network Unavailable

    Hey all, I've been having loads of trouble with the network suddenly going down at my workplace - there are many different ways of handling this, but I just wanted to check if anyone has a good suggestion for managing exceptions on network access throughout an application? I was thinking...
  19. M

    Any sample for HTTP POST Function written in VB.NET?

    hey wonder_gal, i knocked up this demo for you: Dim req As Net.HttpWebRequest Dim resp As Net.HttpWebResponse Dim s As IO.Stream Dim sr As IO.StreamReader Try 'create byte array of post data Dim enc As New System.Text.ASCIIEncoding() Dim postData As String = "name=bob&age=12"...
  20. M

    How do I add a HTTP header to forms-based VB WS client app messages?

    It depends really on how you have implemented the client-side of contacting the webservice. Have a look at using the Net.WebRequest class, you can add custom headers onto this object a POST. Ive used this in several desktop apps which contact webservers and authenticate themselves in the...
Back
Top