vb.net

VB.NET Why won't my Function return an array?

Hi, I'm trying to write a function that returns an Array that I can pass into a String.Format: Public Function ToArray() As Array Dim vals As New ArrayList() vals.Add(Me("district")) vals.Add(Me("county")) vals.Add(Me("route")) vals.Add(Me("section")) vals.Add(Me("beg_logmile")) vals.Add(Me("end_logmile")) ...

Where Can I get a Web Server or File Share Server?

I'm trying to publish my program so that it can get updates and am told I have to publish my changes to a web server or file share server, but I have no idea about how I can go about getting one...are there free ones that will perform what I need to accomplish? ...

Best practice or performance difference between ToString() and & concatenation

When I am concatenating object values together to form a string in VB.NET, is there a difference in performance or a recommended best practice between using the & concat or the + concat with calls to .ToString() on each object? Example (which is faster or best practice): Dim result1 As String = 10 & "em" Dim result2 As String = 10.ToSt...

set label value in vb.net

Hi-- I'm usually a PHP guy but got stuck doing a project in vb.net. I have a query (sqldatasource) that returns a single value (the last update date). I want to use a label to say something like "Last updated: " < Label = (returned value) > In PHP this would be simple. In vb.net, all I can find are endless badly written code behinds s...

How to exit grid with ctrl-TAB when grid is on a tabpage (onkeydown works when grid not on tabpage)

winforms .net 3.5 Ultrawingrid 9.2 In my subclass of Ultrawingrid.Ultragrid : Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs) If e.KeyCode = Windows.Forms.Keys.Tab andalso e.control = True then SetFocusToNextControl(True) End if Mybase.OnKeyDown(e) End Sub This works fine. But w...

.NET generic class instance - passing a variable data type

As the title suggests, I'm tyring to pass a variable data type to a template class. Something like this: frmExample = New LookupForm(Of Models.MyClass) 'Works fine Dim SelectedType As Type = InstanceOfMyClass.GetType() 'Works fine frmExample = New LookupForm(Of SelectedType) 'Ba-bow! frmExample = New LookupForm(Of InstanceOfMyClass.Get...

Active printer problem in Printing word document through VB.net

Hi My printer name is \\abc\First Floor A-Block its taking name \abc\First Floor A-Block on NE04:. How should i print it Private oWord As Word.Application Dim lobjDoc As Word.Document Dim strFolder as String Dim pd As New PrintDocument Dim strPrintername as String oWord = CreateObject("Word.Application") oWord.DisplayAlerts = Word.Wd...

How can I get the nickname and message from raw IRC data in vb.net

Well basically I've got a vb.net script connecting to IRC, and I'm working on making it a basic chat system, but I've run into a problem. Say I receive this: :[email protected] PRIVMSG #channel :message I want to grab specific information to output to the user. I want to grab nickname and message How can ...

What happens in ITemplate.Controls.Add (and ITemplate.InstantiateIn)?

I have a custom Web/Server Control that utilizes templates (ITemplate). Some of these templates repeat based on the provided data. In order to allow for DataBinding/etc I need to "pre-generate" all of the defined templates via code very much like the following (this has been simplified, so keep the laughter to a minimum =): public clas...

Export with VB to Excel and update file

Hello. This is the code that i have to export data to Excel. Dim oExcel As Object Dim oBook As Object Dim oSheet As Object oExcel = CreateObject("Excel.Application") oBook = oExcel.Workbooks.Add oSheet = oBook.Worksheets(1) oSheet.Range("A1").Value = "ID" oSheet.Range("B1").Value = " Nome" oSheet.Range("A1:B1").Font.Bold = True oShee...

Setting the cores to use in Parallelism

Hi, I have a feeling the answer to this is no, but using .Net 4.0's Parallelism, can you set the amount of cores on which to run i.e. if your running a Quad Core, can you set your Application to only use 2 of them? Thanks ...

How can i bind a triplet to a dropdownlist

Hi, i have a list(of triplet) and want to bind this to a dropdownlist. Is this possible without using codebehind? I already tried to DataValueField="First" DataTextField="First" added an extention to the triplet with a function but none worked. any ideas? ...

Try catch finally blocks.. do i still need them when handling errors in the global.asax?

I am handling errors via my global.asax in this method: Dim CurrentException As Exception CurrentException = Server.GetLastError() Dim LogFilePath As String = Server.MapPath("~/Error/" & DateTime.Now.ToString("dd-MM-yy.HH.mm") & ".txt") Dim sw As System.IO.StreamWriter = New System.IO.StreamWriter(LogFilePath) sw.WriteLine(DateTime.Now....

help date format in vb.net

Dim Con As OleDb.OleDbConnection Dim Sql As String = Nothing Dim Reader As OleDb.OleDbDataReader Dim ComboRow As Integer = -1 Dim Columns As Integer = 0 Dim Category As String = Nothing Dim oDatumMin As Date Dim column As String column = Replace(TxtDateMax.Text, "'", "''") 'oDatumMin = Convert.ToD...

Calling a generic function in VB.NET / C#

Question: I want to call a generic function, defined as: Public Shared Function DeserializeFromXML(Of T)(Optional ByRef strFileNameAndPath As String = Nothing) As T Now when I call it, I wanted to do it with any of the variants below: Dim x As New XMLserialization.cConfiguration x = XMLserialization.XMLserializeLDAPconfig.Dese...

How can i read back an object stored in a session?

First of all, here comes the load part. Structure MainStruct Dim Ans1 As String Dim Ans2 As String End Structure Dim Build As New List(Of MainStruct) ... ... ... Session("MyData") = Build The question is how can i read back the contents of the list, stored in the Session? I mean something like... Build = Session("...

C# Value member property repopulate or Re render the control..

Hi.. I just wanted to confirm couple of things. I) Code snippet: cmb1.Datasource= dt; cmb1.Valuemember = "value"; Does the control rendering happens 2 time for the control, 1 more time extra because of the value member getting changed after data source assigned. Is this so? II) How can I trace these re-populations in C#? I just wan...

Help With Proxy Username & Pass with GeckoFX??!!

Hello, I am trying to set the proxy username and password. I saw this posting (http://geckofx.org/viewtopic.php?id=832) and I thought it might be a similar setting for the username/password, such as : Skybound.Gecko.GeckoPreferences.User["network.proxy.user"] = (user); Skybound.Gecko.GeckoPreferences.User["network.proxy.password"] = (...

Get information from a higher class?

I don't know really how to word the question so please bear with me... I have 3 classes: Server, Database, and Table. Each class has a "Name" property. How I want it to work is that each server can have multiple databases and each database can have multiple tables. So in the Server class I have this property. Private _databases As List...

Detecting a message box opened in another application

I am developing a windows service, in vb .et, that launches a legacy application that performs some work. The service acts as a wrapper around the legacy app allowing users to automate an otherwise manual operation. Everything is working great, except occasionally the legacy app displays a messagebox. When it does this the process hal...