VB6 to VB.net conversion [closed]
There is one that comes with vb.net. When you open a .vbp vb6 project, it asks if you would like to automatically convert it to vb.net. It does a pretty good job, exclusive of third party add-ons.
There is one that comes with vb.net. When you open a .vbp vb6 project, it asks if you would like to automatically convert it to vb.net. It does a pretty good job, exclusive of third party add-ons.
Below is code that works for me (NOTE order that I release objects, which is important) xlWorkBook.Close() xlApp.Quit() ReleaseObject(xlWorkSheet) ReleaseObject(xlWorkBook) ReleaseObject(xlApp) Private Sub ReleaseObject(ByVal obj As Object) Try System.Runtime.InteropServices.Marshal.ReleaseComObject(obj) obj = Nothing Catch ex As Exception obj = Nothing Finally GC.Collect() End Try End Sub
There’s no equivalent of C#’s volatile keyword in VB.NET. Instead what’s often recommended is the use of MemoryBarrier. Helper methods could also be written: Function VolatileRead(Of T)(ByRef Address As T) As T VolatileRead = Address Threading.Thread.MemoryBarrier() End Function Sub VolatileWrite(Of T)(ByRef Address As T, ByVal Value As T) Threading.Thread.MemoryBarrier() Address = Value End Sub Also … Read more
Yes that is legacy behavior. Classes did not show up in VB until v4, before that Form1.Show was The Way to show forms. In order to keep previous code compatible (VB3 was also very popular), the old method was maintained. It is still supported in .NET as a legal means to show forms. Initially, this … Read more
This may be an issue with DPI awareness. Specifically, your application is not declared as being DPI aware and when your code accesses the Microsoft.ACE.OLEDB provider, its process is set to being DPI aware. This is something that I discovered by accident a while ago, but I never seen anyone else report it happening. The … Read more
This is done easiest by implementing the IMessageFilter interface in your main form. It lets you sniff at input messages before they are dispatched. Restart a timer when you see the user operating the mouse or keyboard. Drop a timer on the main form and set the Interval property to the timeout. Start with 2000 … Read more
When you use the Image.FromFile(strFileName) method to create the Image, the method locks the file until you release the Image. The exact reason is explained below. And it’s why you can’t access more than one time to the same image file with this method. You could instead: use the Image.FromStream(stream) method. that you use with … Read more
Simply , the .net framework allows you to do that , see http://msdn.microsoft.com/en-us/library/89211k9b(v=vs.80).aspx Relevant information: This goes into the machine.config file: <configProtectedData defaultProvider=”RsaProtectedConfigurationProvider”> <providers> <add name=”RsaProtectedConfigurationProvider” type=”System.Configuration.RsaProtectedConfigurationProvider, … /> <add name=”DataProtectionConfigurationProvider” type=”System.Configuration.DpapiProtectedConfigurationProvider, … /> </providers> </configProtectedData> And this is the application code: Shared Sub ToggleConfigEncryption(ByVal exeConfigName As String) ‘ Takes the executable file name without … Read more
As of Windows Vista, you can use the SendSAS function. Original answer, now superseded by the above The function you need is called SimulateSAS. You need to e-mail [email protected] and ask for it. Microsoft don’t appear to document this, but just do a websearch for SimulateSAS and you’ll see what I mean. Others have explained … Read more
One way you can do this is to use the CellsPainting event to draw the bitmap for a particular header cell. Here is code that does this assuming the bitmap is in an imagelist. //this.images is an ImageList with your bitmaps void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { if (e.ColumnIndex == 1 && e.RowIndex == -1) … Read more