Search results

  1. I

    Some trouble starting an application minimized to the tray

    I wrote an application that by design, when minimized, goes to the tray, and will only show up as a normal form when you doubleclick the icon in the tray. To do this, I added a NotifyIcon, and added these functions: Private Sub Form1_Resize(sender As System.Object, e As System.EventArgs)...
  2. I

    Concatenating conditional XPaths - can this be done easier than this ugly expression?

    Take this XML: <Root> <SourceData> <Name> <Abbreviation>IRS</Abbreviation> </Name> <Type> <Code>T26</Code> </Type> </SourceData> <Employee> <FirstName> <FirstNames> <Name>Bill</Name> </FirstNames> </FirstName> <LastName>...
  3. I

    Conditional Xpath?

    This isn't really a VB question, more of an XML question. Suppose this XML document: <Root> <Gender>Male</Gender> <Name>Bill Gates</Name> <BirthName>William Gates</BirthName> </Root> And this one: <Root> <Gender>Female</Gender> <Name>Melinda Gates</Name> <BirthName>Melinda Ann...
  4. I

    List of objects to CSV?

    Given this code: Public Class Foo Property thing1 As String Property thing2 As String Property thing3 As String Property thing4 As String Property thing5 As String End Class Sub Main() Dim s as String = "" Dim l As List(Of...
  5. I

    Adding a node to a document via XPath?

    Take this XML element: <root> <Alice> <HiredDate>1/1/2016</HiredDate> </Alice> </root> And this code - myXe is type "XElement": dim address as string = "/root/Alice/HiredDate" dim value as string = "2/1/2016" myXe.XPathSelectElement(address).Value = value The first two lines simulate...
  6. I

    How can I deal with XML a namespace, and XPath without a namespace?

    Take this sample code: Dim sXml As String = "<n1 xmlns=" & ControlChars.Quote & "n2" & ControlChars.Quote & "><n3>n4</n3></n1>" Dim address As String = "n1/n3" Dim xDoc As New XmlDocument xDoc.LoadXml(sXml) Dim xNsmgr As New...
  7. I

    Can you programmatically retrieve method information, without knowing the container?

    Take this code: Dim s As String = Foo(AddressOf MsgBox) Console.WriteLine(s) I would like this to print information about the method. This would be good output: Member of Microsoft.VisualBasic.Interaction This would be even better output: Assembly Microsoft.VisualBasic...
  8. I

    Looking for a free and fairly simple tree graph visualizing library

    I have a table, like this: Thing Category Apple Food Bill Gates People Bread Food Chai Tea Edibles Dreamcast Electronics Edibles Everything Electronics Everything FireTV Stick Electronics Food Edibles People Everything Rocks Everything I want to...
  9. I

    troubleshooting a memory leak

    My app has a memory leak. As a first step, I've inserted this line into the main loop: Dim c As Process = Process.GetCurrentProcess() Dim s As String = "Mem: " & c.WorkingSet64 / 1024 & " K " & _ "VM: " & c.PagedMemorySize64 / 1024 & " K " & _ "GC: " &...
  10. I

    Registry virtualization

    I am trying to do what this article suggests: https://msdn.microsoft.com/en-us/library/windows/desktop/aa965884%28v=vs.85%29.aspx Here is my code: Imports Microsoft.Win32 Module Module1 Sub Main() Dim regKey As RegistryKey regKey =...
  11. I

    VS2013: 'warning MSB3061: Unable to delete file' when building a COM interop project

    I've migrated from VS2010 to VS2013, and am running into a rather annoying issue. I have a project with 'Register for COM Interop' checked off. Half the time when I rebuild or clean, I get this: C:\Program Files\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(4319,5): warning MSB3061...
  12. I

    Why isn't my COM interop dependency detected? Longish post

    This is on the long side because more detail will be more useful than less. There is a VB6 app which I do not have the source code for. Let's call it "MXE." One of the files included is called called "mxinterface.dll." It defines an interface called "MXPlugin." This interface allows the...
  13. I

    Reading ambiguous name columns from a SQLDataReader

    Suppose a database with two tables, "Main" and "Users." Main: ID User1ID User2ID 1 1 2 Users: UserID Name 1 Alice 2 Bob I've got a SQL statement that looks something like this: select User1.Name, User2.Name from main inner join Users as User1 on main.User1ID =...
  14. I

    Can you redirect focus from one process to a child process?

    I have a simple forms app with two buttons. Button "Runas" spawns a child process with admin privileges. Button "Close" closes the form. Here is the entire code: Public Class Form1 Private Sub B_Runas_Click(sender As System.Object, e As System.EventArgs) Handles B_Runas.Click Dim...
  15. I

    Is there any way to retrieve another app's "save as" dialog's previous location?

    Is there any way to retrieve another app's "save as" dialog's previous location? There is a third party program, which uses Windows Common Dialog libraries to save and open files. I want to write something that will read files saved by this program, and to do this I will need to retrieve the...
  16. I

    Trying to do a trick with FileStreams - making a file look a few bytes shorter

    I'm not an expert on how stream's work in .NET. I have a file that is basically a 7z archive, except the first 667 bytes are in XML. 7zip.exe itself can extract this file just fine. I am trying to read it using a freeware library called "SharpCompress." It chokes when reading this file. I...
  17. I

    Is it possible to copy multiple files with a single dialog?

    I have code that looks like this: For Each curFile As FileInfo In fileInfoList My.Computer.FileSystem.CopyFile(curFile.FullName, destination, UIOption.AllDialogs, UICancelOption.ThrowException) Next This works, but it results in showing a series of Windows copy dialogs, each one...
  18. I

    What's the best way to deal with a stuck COM call?

    I have a COM dll, which has a class that we'll call "MagicComObject." I have access to its source code, which is VB6, but it is too complicated for me to completely understand. My VB.NET project has a section that looks like this: Dim iCounter As Integer = GetCounterFromRegistry()...
  19. I

    Exposing an enumerable class to VB6

    I have a VB.NET class that looks like this: Public Interface IBottles Inherits IEnumerable End Interface Public Class Bottles Implements IBottles Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator Dim...
  20. I

    Looking for a good example of a database web app

    I'm trying to teach myself how to do stuff in ASP.NET, and I find I learn things best by looking at projects other people have already done, taking them apart, and seeing if I can re-create it. Specifically, what I'm looking for right now is a web form that connects to a locally-run SQL Server...
Top Bottom