|
Thanks for your advice..I will do that and continue to do that. One can never stop learning.
Best regard..
PS. will you guide me?
|
|
|
|
|
i have a vc++ code which are a drawing program.
how can i make it into an ocx so i can use it in vb.net??
|
|
|
|
|
You're in the wrong forum.
But, the control has to be written to support being compiled into an ActiveX control. If it's not, you'll have to rewrite it to support such. Ask further questions about this in the Visual C++ forum. It has nothing to do with VB.NET.
|
|
|
|
|
I need to successfully load and unload assemblies from my vb.net project in real time. Can anyone recommend a tutorial on this process?
Thanks!
|
|
|
|
|
I suggest you google around; look for "AppDomain", as you can't unload assemblies, all you can unload is an AppDomain, so you will have to load assemblies in a new AppDomain, then later unload that AppDomain.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Oh,sorry, yes I understand that this occurs through appdomains. And I've googled and binged my head off on this, but I have yet to find a good solid tutorial on the mechanisms of the process. I was hoping someone here might have a good book or link that would help me.
Thanks
|
|
|
|
|
I don't have any around here, however I would suggest you look at some of these[^].
That may be a little hard though with your head off.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
|
Hello, (know this isn't directly related to vb but didn't know which forum to ask so any help would be appreciated)
I am getting an error from IIS AppPool when attempting to call a WCF service which accesses a table in sqlexpress that's local to my PC. Using server explorer, I can access the table just fine and took the connection string right from server explorer and plugged it into the connection string area of the web.config. What do I need to do with IIS to allow it?
ConnString-> Data Source=xxxxxxxx\SQLEXPRESS;Initial Catalog=GBUtilities;Integrated Security=True"
The Error is (also used default app pool - doesn't matter):
System.Data.SqlClient.SqlException was unhandled by user code<br />
Class=11<br />
ErrorCode=-2146232060<br />
LineNumber=65536<br />
Message=Cannot open database "GBUtilities" requested by the login. The login failed.<br />
Login failed for user 'IIS APPPOOL\Classic .NET AppPool'.<br />
Number=4060<br />
Procedure=""<br />
Server=xxxxxxxx\SQLEXPRESS<br />
Source=.Net SqlClient Data Provider<br />
State=1<br />
StackTrace:<br />
at UtilMgr.GetMenuItems() in C:\inetpub\wwwroot\GB.Utilities.WS\App_Code\UtilMgr.vb:line 18<br />
at SyncInvokeGetMenuItems(Object , Object[] , Object[] )<br />
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)<br />
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)<br />
InnerException:
thank you
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
In the connection string, try replacing Integrated Security=True with Uid=[user];Pwd=[password]
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi
This is not a problem, I'm just trying to make myself clear how ListView works in virtualmode
So, I have ListView1 in virtualmode.
My ListView1 gets virtualitems from array, "baseArray() as ListViewItem":
Private Sub ListView1_RetrieveVirtualItem(..)
Dim x As Integer
x = e.ItemIndex
e.Item = baseArray(x)
End Sub
This works fine and is really fast.
The thing that I don't understand:
Changing the text of displayed ListViewItem or it's subitem affects also the corresponding item in baseArray.
This:
ListView1.Items(iSomeIndex).SubItems(0).Text = "sNewText"
Changes also the corresponding item in baseArray. Why this happens?
It seems that:
ListView1.Items(iSomeIndex)
is actually (I mean physically, sorry for the expression)
baseArray(iSomeIndex)
I earlier thought, that virtualmode copies shown items from baseArray.
But it seems that virtualmode does not work quite that way.
Could some of you explain what happens when virtualmode gets items from baseArray.
Thanks.
|
|
|
|
|
A ListView shows objects, whether it is used in virtual mode or not.
If you set the item at index X to be baseArray(X), then you simply copy the object reference from inside your baseArray array towards the items array inside the ListView, so whatever you do to your ListView item is changing your object in the baseArray, as they are one and the same object.
BTW: it does not make sense to have an array that "shadows" your items in a ListView, when you decided you want virtual mode; virtual mode is meant to overcome memory or speed limitations, that would arise when you would put a huge number of objects on a ListView, which in non-virtual mode would mean they have to reside in memory. So with virtual mode, you could create kind of a caching scheme, where only the currently visible objects need to be in memory.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Thanks
First part of Your answer was clarifying.
But this is not clear yet:
"it does not make sense to have an array that "shadows" your items in a ListView
Do you mean that it's not clever to use an array of ListViewItems, because the array itself consumes memory or speed? But how could it be done then? Data needs to be provided somehow for the ListView.
Data shown in ListView is stored in Database. During startup data is collected into this baseArray. Do you mean that data could be taken from the database into cache in runtime?
jtpaa
|
|
|
|
|
jtpaa wrote: During startup data is collected into this baseArray
That means all data is in memory, and virtual mode will not bring anything.
jtpaa wrote: Do you mean that data could be taken from the database into cache in runtime?
Yes. A very simple implementation would be to have RetrieveVirtualItem to go out and fetch one item from the database and feed it to the ListView. That way, you would not be holding any data in memory yourself, and the ListView would hold whatever it needs, and no more.
I am not saying this is the best approach, as it would cause a lot of small Database operations. There typically is an optimum somewhere in between; if you are willing to spend the effort, you could:
- create a cache, keeping a limited number of items, using WeakReference to make them garbage collectable;
- inside RetrieveVirtualItem, first look for the item in the cache; if found, pass it on. If not, read a number of items from the database, add them to the cache, and pass on the wanted one.
That is why it is called virtual: the ListView will act as if it has all data, but in reality it only has part of the data at any one point in time, sufficient to show the visible parts.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Ok
But could we say that my virtualmode version was atleast 5% virtual
Yes, the first thing that comes into my mind is that DB operation can be a bit slow because Database can also locate in local network. But this could be solved by taking several items with one search into cache.
Second thing is sorting. There are two columns (alphanumeric strings) in my ListView and user must be able to sort both columns. Also in sorting itself there has been difficulties. I haven't find a way to sort mixed strings properly with sql query.
jtpaa
|
|
|
|
|
when a list is virtual, it can't sort as it does not hold all the data; sorting means either the list is not virtual, or you do the sorting, the list does the displaying.
You can do sorting by including that in the SQL statement; see the ORDER BY clause.
If you can and are willing to keep the data all in memory (and suffer a potential startup delay), there is no need for virtual mode. If not, you need to add something clever; using virtual mode would be a part of that; caching could also be; keeping one or two entire columns (for sorting) is also conceivable.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
We have a working program in VB6 that gets the Windows Registered users and organization from the registry. It works fine on XP, Vista, etc.
If fails on Windows 7 and I believe W2008.
It returns Microsoft (which is incorrect) for both.
When we tried it with VB.net 2008 using
my.computer.registry.localmachine etc
It also fails but the same way. Obj below contains the string Microsoft. The line under (s =) also has Microsoft.
Can get the names but not the values????
Why
Here is the code.
Dim i As Short = 0
Dim s As String = vbNullString
Dim VNAR() As Object, SKNamesAR() As Object, Obj As Object
Const RO As String = "RegisteredOwner", ROrg As String = "RegisteredOrganization"
Const CV As String = "Software\Microsoft\Windows NT\CurrentVersion\" ' & RO
Const CVRO As String = CV & RO, CVROrg As String = CV & ROrg
Dim RK As Microsoft.Win32.RegistryKey = _
My.Computer.Registry.LocalMachine.OpenSubKey(CV)
Dim RK2 As Microsoft.Win32.RegistryKey
VNAR = RK.GetValueNames()
SKNamesAR = RK.GetSubKeyNames()
RK2 = RK.OpenSubKey(RO)
i = i
Obj = RK.GetValue(RO)
i = i
s = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", vbNullString)
|
|
|
|
|
That's the same place to get it in Windows 7. If this code is running under a 64-bit version of Windows 7, it won't work since VB6 cannot see the 64-bit registry, which is where this registration info would be stored. It should work fine under 32-bit Windows 7.
|
|
|
|
|
Thanks
Our products use the QuickBooks SDK which require running in x86 mode.
So what you are saying is that none of our products (VB6 or .Net) will be able to access the registry????
I believe that we can get other registry entries from VB6 wnd x86 versions of VB.NET. These would be entries that we create ourselves from the program.
So is there any way for this to work????
|
|
|
|
|
On x64 Windows, the Registered owner information is only written to the 64-bit side of the registry. You cannot get to it from a 32-bit application, like your VB6 code, or VB.NET code compiled as x86 only.
What your app is actually seeing (because you're running 32-bit code on a 64-bit OS) is stored under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion.
There are two ways to allow your app to get at the 64-bit registry. The first option is you'd have to use the Win32 Registry functions directly. You cannot use the built in Registry classes in VB6 or the .NET Framework to do this. Read more about the functions you have to use here[^].
The second option is to do it through WMI. YOu can read more about that here[^].
In eitehr case, you'r calling the Win32 functions directly, unable to use an built-in classes to make this easier for you.
|
|
|
|
|
Thanks Dave but this is a problem.
Our programs HAVE to run 32 bit mode for the other SDKs that we are using otherwise the main function will not work.
I am not clear on exactly what 'Win32 functions directly' means.
Do you mean something like this (taken from VB6)?
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" _
(ByVal lngRootKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, _
lpType As Long, lpData As Any, lpcbData As Long) As Long
RegQueryValueEx(lngKeyHandle, strRegSubKey, 0&,lngDataType, ByVal 0&, lngBufferSize)
You would think that the built in cases would handle it no matter what OS you are on. This is why many applications don't run on 64 bit OSes.
|
|
|
|
|
QBTeKcom wrote: Do you mean something like this (taken from VB6)?
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" _
(ByVal lngRootKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, _
lpType As Long, lpData As Any, lpcbData As Long) As Long
RegQueryValueEx(lngKeyHandle, strRegSubKey, 0&,lngDataType, ByVal 0&, lngBufferSize)
Yep. But, don't use VB6 versions of these Declares. The Long type in VB6 is not the same as the Long type in VB.NET.
QBTeKcom wrote: You would think that the built in cases would handle it no matter what OS you are on. This is why many applications don't run on 64 bit OSes.
The problem is that your 32-bit app shouldn't be using the 64-bit registry at all. After all, how are you going to use a 64-bit value in a 32-bit app? You can't...
QBTeKcom wrote: This is why many applications don't run on 64 bit OSes.
Not true. The reason they don't work is because they're not written properly in the first place. Most applications, historically, have been written assuming that all users are administrators on their machines. With Vista and 7, this simply isn't the case anymore, and for good reason. 64-bit has nothing to do with the problem.
|
|
|
|
|
Hi everybody,
to get out of a coding maze I'm stuck in, some input would be very welcome. In my application I set up a plugin framework using an IPlugin interface. What I want to achieve is that each plugin can react to (some) events of another plugin. Since I'm not so secure about the whole issue yet, I got lost... and stuck for hours now.
Does anyone have a good idea which would be the right way to pass events from one plugin to the other?
Thanks for some advice
Michael
|
|
|
|
|
You can't do it directly, that I can see anyway...
I think you'd have to come up with a way register those events with the plugin manager and any other .DLL's would have to subscribe to those events by getting a reference to them from the plugin manager.
But, this also exposes an order-of-load issue. What if a potential subscriber .DLL is loaded before the .DLL that is exposing the events?? You'd need som mechanism to tell each plugin that a new set of events is now available and they would get to subscribe to those events. I think your IPlugin interface just got a bit more complicated, or, at the very least, you just added a couple more interfaces to your plugin architecture.
No, I don't have anny examples since I've never done any kind of event generation in plugins. I'm only spewing from a thought experiment.
|
|
|
|
|
Hi Dave,
I am trying around with what you write: a way to register the events in the interface, so that other plugins can subscribe to selected events... I'm just tapping in the dark with which code line has to go into which class etc. (more details I wrote in the other answer, if you'd like to consider). Regarding the order-of-load issue I thought it might be possible to have a plugin subscribe to the anonymous standard (defined in the interface) and receive what comes... just like you connect a hose to a pipe and find out if it's beer or oil later
Thank you for having a look, anyway!
|
|
|
|
|