|
Eddy Vluggen wrote: Read that again; extended support ended four years ago.
Imagine your virusscanner being outdated four years.
Your right of course and my comment was not intended to be serious but...
Why should it worry me if the extended support that I never used anyway has expired. As long as the program is a valid method of producing binaries (maybe I should keep quiet about that is it isn't at the moment ) then I see no reason why I shouldn't use it
I like the language and, as the largest project is up to 140,000 lines of code, moving to another development environment is not at all easy but as the whole things changes every few years anyway it is hard to see the point. It would be interesting to know the overall number of developers currently using vb6, vb2005, vb2008, vb2010
I am not a luddite and keep up to date with technology but my grandads King Dick socket set still seems to work as well for me as it did for him when he bought it quite a few years ago
Thank you for your helpful advice
|
|
|
|
|
Mike Deeks wrote: Why should it worry me if the extended support that I never used anyway has expired.
It should worry the owner of the project; if your project is written in a dying language, the project will die along with the language. Unless you have the sources to Windows XP and VB6 (including the dependencies)
Mike Deeks wrote: I like the language and, as the largest project is up to 140,000 lines of code, moving to another development environment is not at all easy
It IS easy - it's also a lot of work, but it ain't complex. The longer you write new code in VB6, the more you'll have to migrate.
Mike Deeks wrote: I am not a luddite and keep up to date with technology but my grandads King Dick socket set still seems to work as well for me as it did for him when he bought it quite a few years ago
Hehe, aight - if it ain't broke, don't fix it. You got a good point there. And yes, I admit that even 16-bit apps from Win3.1 might still run on Win7, but if something goes wrong, you're (almost) on your own.
You can't compare VB6-code to "pascal code", or any other "older" language; VB6 is tied to Microsoft, is proprietary (they own the language), and it will die if they do not support the language actively.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Make sure the folder is writable and that the target .EXE file isn't locked (running) or, even better, doesn't exist already.
|
|
|
|
|
unfortunately all checked and even changed the folder just in case
some projects compile and some give the "unexpected error"
I will have to go through and check references/components to see if there is any commonality
|
|
|
|
|
Either that or the VB6 compiler is finally rotting away. Good riddance!
|
|
|
|
|
Dave Kreskowiak wrote: VB6 compiler is finally rotting away
Wooooot!!!!
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
When you build COM objects, those COM objects get registered. And that means: writing to the registry in a part where a user must not write.
Hence my idea: Do you get the same error when you run the IDE in elevated mode?
|
|
|
|
|
don't think you can elevate on Windows XP SP3
and I am an administrator on the PC
but good thought
|
|
|
|
|
True, the virtual machine has its own registry, and with XP, an administrator can write to that.
|
|
|
|
|
On MSDN, I found code that is designed to change between multiple sound cards on a PC. I need to do this in .NET. I attemped to translate the VB6 code on MSDN (see link) into .NET but wind up with a PInvokeStackImbalence exception.
http://support.microsoft.com/kb/180032[^]
Here is my attempted translation:
Imports System.Runtime.InteropServices
Public Class MediaManager
Structure MCI_WAVE_SET_PARMS
Dim dwCallback As Long
Dim dwTimeFormat As Long
Dim dwAudio As Long
Dim wInput As Long
Dim wOutput As Long
Dim wFormatTag As Integer
Dim wReserved2 As Integer
Dim nChannels As Integer
Dim wReserved3 As Integer
Dim nSamplesPerSec As Long
Dim nAvgBytesPerSec As Long
Dim nBlockAlign As Integer
Dim wReserved4 As Integer
Dim wBitsPerSample As Integer
Dim wReserved5 As Integer
End Structure
Public Enum SoundFlags As UInteger
SND_SYNC = &H0
SND_ASYNC = &H1
SND_NODEFAULT = &H2
SND_MEMORY = &H4
SND_LOOP = &H8
SND_NOSTOP = &H10
SND_NOWAIT = &H2000
SND_ALIAS = &H10000
SND_ALIAS_ID = &H110000
SND_FILENAME = &H20000
SND_RESOURCE = &H40004
End Enum
Private Declare Auto Function PlaySound Lib "winmm.dll" (ByVal pszSound As String, ByVal hmod As UInteger, ByVal fdwSound As UInteger) As Boolean
Private Declare Auto Function mciSendCommand Lib "winmm.dll" Alias "mciSendCommandA" (ByVal wDeviceID As Long, ByVal uMessage As Long, ByVal dwParam1 As Long, ByRef dwParam2 As MCI_WAVE_SET_PARMS) As Long
Sub New()
Dim Parameters As MCI_WAVE_SET_PARMS
mciSendCommand(0, &H80D, &H800000, Parameters)
PlaySound("C:\thermo.wav", 0, SoundFlags.SND_FILENAME Or SoundFlags.SND_ASYNC Or SoundFlags.SND_LOOP)
End Sub
End Class
Can Anyone assist me?
Thanks,
kingneb
|
|
|
|
|
When calling native code from managed code, stack imbalances are most often caused by applying the wrong "calling convention" (which says who, caller or callee, is responsible for cleaning up the stack). You will need to apply an explicit DllImport directive and specify the correct calling convention, most likely StdCall .
You will find an example here[^].
I wrote a little article[^] on P/Invoke, unfortunately it isn't finished yet, so it doesn't have the details for VB.NET; you might find it useful anyway.
|
|
|
|
|
OK, I specified the standard calling convention, but no cigar? I think it is something else unless I am still not using the right calling convention.
Imports System.Runtime.InteropServices
Public Class MediaManager
Structure MCI_WAVE_SET_PARMS
Dim dwCallback As Long
Dim dwTimeFormat As Long
Dim dwAudio As Long
Dim wInput As Long
Dim wOutput As Long
Dim wFormatTag As Integer
Dim wReserved2 As Integer
Dim nChannels As Integer
Dim wReserved3 As Integer
Dim nSamplesPerSec As Long
Dim nAvgBytesPerSec As Long
Dim nBlockAlign As Integer
Dim wReserved4 As Integer
Dim wBitsPerSample As Integer
Dim wReserved5 As Integer
End Structure
Public Enum SoundFlags As UInteger
SND_SYNC = &H0
SND_ASYNC = &H1
SND_NODEFAULT = &H2
SND_MEMORY = &H4
SND_LOOP = &H8
SND_NOSTOP = &H10
SND_NOWAIT = &H2000
SND_ALIAS = &H10000
SND_ALIAS_ID = &H110000
SND_FILENAME = &H20000
SND_RESOURCE = &H40004
End Enum
Private Declare Auto Function PlaySound Lib "winmm.dll" (ByVal pszSound As String, ByVal hmod As UInteger, ByVal fdwSound As UInteger) As Boolean
<DllImport("winmm.dll", CallingConvention:=CallingConvention.StdCall)>
Private Shared Function mciSendCommand(ByVal wDeviceID As Long, ByVal uMessage As Long, ByVal dwParam1 As Long, ByRef dwParam2 As MCI_WAVE_SET_PARMS) As Long
End Function
Sub New()
Dim Parameters As MCI_WAVE_SET_PARMS
mciSendCommand(0, &H80D, &H800000, Parameters)
PlaySound("C:\thermo.wav", 0, SoundFlags.SND_FILENAME Or SoundFlags.SND_ASYNC Or SoundFlags.SND_LOOP)
End Sub
End Class
Thanks,
kingneb
|
|
|
|
|
Are you still getting StackImbalance exceptions, or something else?
Using P/Invoke is very similar to programming assembly code, it requires great meticulousness.
In this short time, you did not read the MS link I provided and my article. If you had, you would know that data types differ in managed and native worlds, so your long s very likely are wrong too. And there may be more. Don't expect this to work in a matter of minutes, start with a simple function and get that working, then build from there.
Take your time, experiment, learn the technology. And when you run into real trouble, ask specific questions providing detailed and accurate observations. "No cigar" isn't helpful.
|
|
|
|
|
On top of what Luc said, if you're converting VB6 code to VB.NET the biggest trip is using the wrong data types:
VB6 type VB.NET type
--------- = ------------
Byte Byte 8-bit unsigned integer
Integer Short 16-bit signed integer
Long Integer 32-bit signed integer
Single Single 32-bit floating point
Double Double 64-bit floating point
Currency Decimal (not a direct conversion)
When the function you're calling expects a certain size value, using the wrong type will most assuredly screw up the stack.
Also, you may want to bookmark P/Ivoke.net. It has the correct signatures for most Win32 functions for C# and VB.NET. For example, PlaySound[^] and mciSendString[^], as well as tons more.
|
|
|
|
|
In PlaySound, the second parameter is an IntPtr, the third an Int32.
In mciSendCommand, the first parameter is an IntPtr. Also the last parameter is likely an IntPtr, i.e. you'll have to use Marshal.Alloc and Marshal.StructureToPtr .
|
|
|
|
|
Any luck yet? I have received this error when my parameters didn't quite map between VB.Net types and unmanaged types. If you still need help, I can take a look and see if I can get a working PlaySound sample.
|
|
|
|
|
If I change the datatypes in the method declaration, and change the way its called by using Marshal to copy the values back and forth from unmanaged. I am getting a result of 257 which means 'Invalid DeviceID' which is expected since we passed it 0 as a deviceID.
Example:
'Used to change between different sound cards.
Private Declare Auto Function mciSendCommand Lib "winmm.dll" Alias "mciSendCommandA" (ByVal wDeviceID As UInteger, ByVal uMessage As UInteger, ByVal dwFlags As IntPtr, ByRef dwParam2 As IntPtr) As Integer
Public Sub TestMciSendCommand()
Dim Parameters As MCI_WAVE_SET_PARMS
Dim fwdCmd, dwParam As IntPtr
Dim mciResult As Integer
Dim deviceID As UInteger
Try
dwParam = Marshal.AllocHGlobal(Marshal.SizeOf(GetType(MCI_WAVE_SET_PARMS)))
Marshal.StructureToPtr(Parameters, dwParam, False)
fwdCmd = Marshal.AllocHGlobal(Marshal.SizeOf(GetType(Integer)))
Marshal.WriteInt32(fwdCmd, &H800000)
deviceID = 0 ' TODO: Get the actual deviceID
' results in error # 257 - MCIERR_INVALID_DEVICE_ID
mciResult = mciSendCommand(deviceID, &H80D, fwdCmd, dwParam)
Parameters = CType(Marshal.PtrToStructure(dwParam, GetType(MCI_WAVE_SET_PARMS)), MCI_WAVE_SET_PARMS)
Catch ex As Exception
Debug.WriteLine(String.Format("mciSendCommand Failed with message: {0}", ex.Message))
Debug.WriteLine(ex)
Finally
' Clean up unmanaged memory allocations!
Marshal.FreeHGlobal(fwdCmd)
Marshal.FreeHGlobal(dwParam)
End Try
End Sub
Error Codes Reference[^]
Hopefully all that remains is to find the proper deviceID. Best of luck to you.
|
|
|
|
|
System.Web.DataVisualization.dll i need this file so if you have this file then please upload .
Thank you in advance.
|
|
|
|
|
The file is part of a set, I suggest you install the entire package.
MS Chart Controls[^]
Next thing to do is to pick up a sheet of paper, and to title it "documentation". Jot down all the files that you're referencing, why they were needed, and where to get 'em.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hello !
i'm working on a vb.net 2010 /SQL server 2008 / Entity Framework
i have a bound datagridview with 3 columns , and inside datagrid i have an unbound combobox column that have some numbers as items (1,2,3).
if i try to select a value from unbound combobox , after leaving the cell the value on combobox is back to default value.
what can i do ?
modified 16-Jul-12 21:26pm.
|
|
|
|
|
Is this an Asp.Net project? One idea would be to make it a bound column and create a layer of indirection for the data source by using a custom class that takes into account the extra column. Another would be to check out the viewstate, maybe? That's assuming that it is an ASP.net project.
|
|
|
|
|
HI I am not expert in visual, but i try to make a program to search text in multi excel sheets. My setup is like this
I have one textbox1(to write the word i want to search for)
one search buttom
Listbox1(To add files strings for the search)Working good
buttom for clear all,clear selected,and add also working here
Listbox2(To see the result when i press search.) Not working
buttom for clear all,clear selected,and add also working here(working)
My problem is that i have searched all over to find the code for the search buttom.
I have tried many exsamples, but it always dont work.
Function is that i will add files to Listbox1(one or more)
then i textbox1 i will type the search word.
In the search buttom i press search
And then in Listbox2, The result will come out in strings(would like if i can open these string also, or see th formula from the excel sheet)
Would highly appriciate some, who have solved this or have a working solution.
I am not expert, so a full code would be appriciated.
Thanks in advance
Sincerely
abjac .
|
|
|
|
|
abjac@ wrote: Listbox2(To see the result when i press search.) Not working You need to explain what "not working" means if you expect people to be able to make useful suggestions to help you.
|
|
|
|
|
Sorry that was maybe the wrong expression. I made this setup and the search bottum(button1), when i press it it always comes up with and error. But the fact is that the code comes up with this error.
Could not find a part of the path 'C:\Documents and Settings\Alancecille\Desktop\listbox1.text'.
DirectoryNotFoundException was unhandled
But this is the path i add in listbox1 with out any problems. So i dont know why it can not find it.And also i dont know if i can use this code. The idea is to add the files(xls) i want to search in in Listbox1 and then then type the search word in textbox1, and when i press search, it shall find all strings(or formula) in the excel sheet, which have this word included. Please have a look at below code and come with some suggestions.
Thanks in advance
abjac
This is my code and as you can see the code for bottun1 is the one which cause the error, but also i think this maybe is not correct.
Imports System.IO
Public Class Form1
Dim streamer As IO.StreamReader
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim open As New OpenFileDialog
Try
open.Title = "Open Excel Sheets"
open.FileName = "xls"
open.Multiselect = True
open.Filter = "xls files |*.xls"
If open.ShowDialog = Windows.Forms.DialogResult.OK Then
For Each file As String In open.FileNames
ListBox1.Items.Add(file)
file = False
Next
End If
Catch ex As Exception
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
ListBox1.Items.Remove(ListBox1.SelectedItem)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
ListBox1.Items.Clear()
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
ListBox2.Items.Clear()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
ListBox2.Items.Remove(ListBox2.SelectedItem)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim filenames = My.Computer.FileSystem.FindInFiles("listbox1.text", "textbox1.text", True, FileIO.SearchOption.SearchAllSubDirectories)
For Each filename As String In filenames
ListBox2.Show()
Next
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim SaveFile As New SaveFileDialog()
SaveFile.Filter = "Multi search in Excel |*.xls"
SaveFile.FileName = "xls"
SaveFile.ShowDialog()
Dim WriteFile As New System.IO.StreamWriter(SaveFile.FileName)
Dim Count As Integer = ListBox1.Items.Count - 1
For i As Integer = 0 To Count
WriteFile.Write(ListBox2.Items.Item(i) & ";") 'the “;” is used to separate the items
Next
WriteFile.Close()
End Sub
End Class
modified 16-Jul-12 16:44pm.
|
|
|
|
|
My.Computer.FileSystem.FindInFiles(directory:= As String,containsText:= As string)
You are giving a constant text
Dim filenames = My.Computer.FileSystem.FindInFiles("listbox1.text", "textbox1.text", True, FileIO.SearchOption.SearchAllSubDirectories)
Your dir is something like C:\dir1\dir2
Your text must be without quotes
Jan
|
|
|
|
|