|
Hey all!
Got something i need help on.
How can i make a panel's vertical scroll bar to act and control another particular datagrid or another component for that matter.
So when the vertical scroll is moved, both the panel and the other form(eg; datagrid) should be scrolled as well.
Thx in advance!
regards,
Jensen
|
|
|
|
|
You can checkout the response to an article here[^] that describes an alternate method to the articles method.
Either will work...
|
|
|
|
|
Thx dave!
you've helped me one time too many! ur the best.
Regards,
Jensen
|
|
|
|
|
Hello again!
Im' having a tough time to solve this... really need help!
As Dave had pointed out to me this article here[^], i've tried the method suggest by the response to that article and what i've found is that it works when im implementing it to synchronize two richtextboxes....but what it dint' work its when ive tried the same concept to synchronize them with either two data grid / panel / or the combination between both.
Could someone check this out?
Thx in advance!
Regards,
jensen
|
|
|
|
|
I am just starting out with VB 2005 express, and I'm having trouble defining global variables.
I want to use (read and write) the same variables in many different class subroutines, so I want to declare them as global variables.
To do this I created a module called modMain, and defined the variables in the declarations section of the module using script such as
Public strPartNumber As String
Public Const c_ItemNumber As Integer = 1
Public strPartArray (300,5) As String
When I run the code, the program stops at the line within a class subroutine, in which I am trying to change the value of a variable with the command:
strPartNumber = "QQQQ"
The error returned is 'TypeInitializationException was unhandled'
I'd be grateful if anybody could tell me what I'm doing wrong.
Thanks
Andy Scott
Andy Scott
|
|
|
|
|
Is your array definition correct ? It's not const, in any case, so it's not going to be global.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian,
The honest answer is that I believe my array definition to be good, but the program falls over before I reach anything accessing that array.
Do you have any idea why I can't write to the string variable? If I hover my cursor over the variable name, it returns the 'QQQQ' as per the original definition, appearing as if the program is able to read the variable, but not write to it.
Andy
Andy Scott
|
|
|
|
|
Ah... I saw const and thought it was 'shared' ( given that I knew it was not 'static', as in C# ). That's why I said that just some of the variables were not going to be visible, as Dave said, none of them are. That's a weird compiler error tho, when the problem is that the variables are not visible.
I agree with Dave, globals are generally a bad idea. I confess to using them from time to time, tho, for example, I would write a global class to handle settings in ways I consider nicer to what the default MS stuff does. Just proceed with care.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: I confess to using them from time to time, tho, for example, I would write a global class to handle settings in ways I consider nicer to what the default MS stuff does.
I, too, am guilty as charged. Sometimes it's just easier than jumping through a bunch of MS hoops.
|
|
|
|
|
I just don't get why I need to create a settings object, and call it's Save method when I make a change. The Save, I can almost deal with ( it allows an Apply button ), but it's possible to have settings objects all over the place, which are then disconnected. So, having one static instance makes sense, and then having done that, adding the properties and making them call Save themselves, also makes sense in some instances.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
If you have a "global" variable like this, you more than likely have a bad design.
"Global" variables don't exist under the .NET CLR, byt you can simulate them using Shared variables in a class:
Public Class Globals
Public Shared strPartNumber As String
End Class
But, like I said, this is a bad design! You should never have to hold a global variable like this for a bunch of subs and functions to use. You should be either encapsulating the required functionality into a class representing a part and/or passing the part number to outside methods in their parameter lists that require working on a part number.
|
|
|
|
|
You can also use a module, it is a good way to keep C# programmers away from your code.
module module1
public global_variable as integer
end module
|
|
|
|
|
Modules are a backwards compatibility nightmare retained for VB6 users who don't want to learn OOP.
|
|
|
|
|
I like using a module for my sub main...but thats where it ends...
--
"Keyboard not found. Press < F1 > to RESUME. "
Source unknown (appears in many common BIOSes as a real error message)
|
|
|
|
|
Why not just move the Main code inside a class, such as a Form??
I don't use Modules for ANYTHING, even when I use a Main to get thing going...
|
|
|
|
|
just feels cleaner to separate it...a lot of times apps have conditional startup forms depending on the situation...maybe a first run wizard, etc...you can technically use a class instead of a mod, but a mod is easier and requires less code.
--
"Keyboard not found. Press < F1 > to RESUME. "
Source unknown (appears in many common BIOSes as a real error message)
|
|
|
|
|
Polymorpher wrote: but a mod is easier
Only because it's in its own file.
Polymorpher wrote: requires less code.
No, it doesn't. It actually requires a little bit more. There is no difference between the code you put in a module and the code you put in a class.
|
|
|
|
|
The code in a class has to be shared, or static in C#...in a mod its just
Public Sub Main()
End Sub
--
"Keyboard not found. Press < F1 > to RESUME. "
Source unknown (appears in many common BIOSes as a real error message)
|
|
|
|
|
I currently use IsUserAnAdmin() api function , MSDN :
Minimum DLL Version shell32.dll version 5.0 or later
Custom Implementation No
Header shlobj.h
Import library shell32.lib
Minimum operating systems Windows 2000
But many users reported this function doesn't exist in Windows 2000
How to tests whether the current user is an admin ?
Thank you
|
|
|
|
|
It does exist, it's just not exported by name.
According to the export list of Shell32.dll on Windows XP, IsUserAnAdmin is ordinal #680 (decimal). The oridnal number should not change between versions, so it should be the same in the Windows 2000 version.
So, in order to use it in Windows 2000, you have to specify the function's ordinal number instead of its name. If I remember correctly, its Declare looks like this:
Declare Function IsUserAnAdmin Lib "shell32.dll" Alias "#680" () As Boolean
|
|
|
|
|
|
Hi
I have a project where can change font color but cant't change when selected a line color always is in blue.. Can you help.
papoluca
|
|
|
|
|
Hi
I have a project where can change font color but cant't change when selected a line color always is in blue.. Can you help.
VISUAL BASIC 6 w SP6
papoluca
|
|
|
|
|
Hi
I have a LISTVIEW project where can change font color but cant't change when selected a line color always is in blue.. Can you help me.
VISUAL BASIC 6 w SP6
papoluca
|
|
|
|
|
Are you having fun talking to yourself??
There's a ton of examples on how to do this in VB.NET, but I can't find any VB6 examples to do this anymore.
Why are you using VB6 in the first place? It's not supported by Microsoft anymore. I, myself, haven't used it in over 6 years now...
|
|
|
|