|
Thanks for the link. I'll try the script...
|
|
|
|
|
Hello. I am portuguese, sorry if my english isn't good.
I have a Datagrid. I want to use the keyDown event to reconize one key. But I have no luck at all. The problem is that the keydown event won't fire at all, unless I click on a row (withs will be selected) and then click on it again. Now if I press any key the event will fire.
When a row is selected i want that if one key is pressed the data in the row selected go for another form.
waiting for your help...
Thanks.
|
|
|
|
|
hi,
create custom table styles for that datagrid and then check it out
|
|
|
|
|
It works fine. Thanks.
|
|
|
|
|
I have several *.config files located in various directories. Some of the *.config files contain lines similar to this:
add key="Raw Data Quality = " value="0"
add key="Raw Data Justification = " value="Component quality is good and was constructed from good data."
add key="Data Completeness = " value="-1"
add key="Data Completeness Justification = " value="This should be written out in the Non-Zero report."
I’m trying to extract all non-zero value s, and print (to a new line in a text file) the key of the non-zero and the value of the key on the next line.
Like this:
Data Completeness = -1: This should be written out in the Non-Zero report.
I apologize for asking such a broad question. I’ve spent hours trying to figure out how to write the *.config file and now I can’t seem to find out how to read this format back out to a text file.
Thanks
Brad
|
|
|
|
|
|
Hey ppl, I have ported this code from a vb6 example, but can't seem to get it working... Any ideas
<br />
Private Class TitleBarInfo<br />
<System.Runtime.InteropServices.DllImport("user32")> Shared Function GetTitleBarInfo(ByVal hwnd As IntPtr, ByRef pti As TITLEBARINFO) As Boolean<br />
End Function<br />
<br />
<br />
Private Const STATE_SYSTEM_FOCUSABLE As Integer = &H100000<br />
Private Const STATE_SYSTEM_INVISIBLE As Short = &H8000S<br />
Private Const STATE_SYSTEM_OFFSCREEN As Integer = &H10000<br />
Private Const STATE_SYSTEM_UNAVAILABLE As Short = &H1S<br />
Private Const STATE_SYSTEM_PRESSED As Short = &H8S<br />
Private Const CCHILDREN_TITLEBAR As Short = 5<br />
Public Structure RECT<br />
Public left As Integer<br />
Public top As Integer<br />
Public right As Integer<br />
Public bottom As Integer<br />
End Structure<br />
Public Structure TITLEBARINFO<br />
Public cbSize As Integer<br />
Public rcTitleBar As RECT<br />
<VBFixedArray(CCHILDREN_TITLEBAR)> Public rgstate() As Integer<br />
Public Sub Initialize()<br />
ReDim rgstate(CCHILDREN_TITLEBAR)<br />
End Sub<br />
End Structure<br />
Public Shared Function GetTitleBarInfo(ByVal Handle As IntPtr) As TITLEBARINFO<br />
Dim TitleInfo As TITLEBARINFO<br />
'Initialize structure<br />
TitleInfo.Initialize()<br />
TitleInfo.cbSize = Len(TitleInfo)<br />
<br />
GetTitleBarInfo(Handle, TitleInfo)<br />
return TitleInfo<br />
Return TitleInfo<br />
End Function<br />
End Class<br />
|
|
|
|
|
Private Structure TITLEBARINFO
Dim cbSize As Integer
Dim rcTitleBar As RECT
<VBFixedArray(CCHILDREN_TITLEBAR + 1)> _
Dim rgstate() As Integer
Public Sub Initialize()
ReDim rgstate(CCHILDREN_TITLEBAR + 1)
End Sub
End Structure
and
GetTitleBarInfo(Me.Handle.ToInt32, TitleInfo)
hope this helps
|
|
|
|
|
Sorry AndrewVos,
I sent that last message to fast, I checked it again and I was still getting a error 87, sorry.
add this import:
Imports System.Runtime.InteropServices
and the structure should be more like this:
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
Private Structure TITLEBARINFO
Dim cbSize As Long
Dim rcTitleBar As RECT
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=CCHILDREN_TITLEBAR)> _
Dim rgstate() As Long
Public Sub Initialize()
ReDim rgstate(CCHILDREN_TITLEBAR)
End Sub
End Structure
It should return err code 0 now.
hope that helps
|
|
|
|
|
Still not working... The elements of rgstate() are all = 0.
Consider this code....
<br />
Private Class TitleBarInfo<br />
<System.Runtime.InteropServices.DllImport("user32")> Private Shared Function GetTitleBarInfo(ByVal hWnd As IntPtr, ByRef pti As TITLEBARINFO) As Boolean<br />
End Function<br />
<br />
Private Const STATE_SYSTEM_FOCUSABLE As Integer = &H100000<br />
Private Const STATE_SYSTEM_INVISIBLE As Short = &H8000S<br />
Private Const STATE_SYSTEM_OFFSCREEN As Integer = &H10000<br />
Private Const STATE_SYSTEM_UNAVAILABLE As Short = &H1S<br />
Private Const STATE_SYSTEM_PRESSED As Short = &H8S<br />
Private Const CCHILDREN_TITLEBAR As Short = 5<br />
Public Structure RECT<br />
Public left As Integer<br />
Public top As Integer<br />
Public right As Integer<br />
Public bottom As Integer<br />
End Structure<br />
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> Private Structure TITLEBARINFO<br />
Dim cbSize As Integer<br />
Dim rcTitleBar As RECT<br />
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=CCHILDREN_TITLEBAR + 1)> Dim rgstate() As Integer<br />
Public Sub Initialize()<br />
ReDim rgstate(CCHILDREN_TITLEBAR + 1)<br />
End Sub<br />
End Structure<br />
<br />
Private Shared Function GetTitleBarInfo(ByVal Handle As IntPtr) As TITLEBARINFO<br />
Dim TitleInfo As TITLEBARINFO<br />
'Initialize structure<br />
<br />
TitleInfo.Initialize()<br />
TitleInfo.cbSize = Len(TitleInfo)<br />
<br />
' GetTitleBarInfo(Handle, TitleInfo)<br />
GetTitleBarInfo(Handle, TitleInfo)<br />
'Show some of that information<br />
Return TitleInfo<br />
End Function<br />
<br />
<br />
Public Shared ReadOnly Property CaptionButtonCount(ByVal Handle As IntPtr) As Integer<br />
Get<br />
Dim count As Integer<br />
<br />
Dim tbi As TITLEBARINFO<br />
tbi = GetTitleBarInfo(Handle)<br />
<br />
'Index TitleBar Element<br />
'0 The title bar itself. <br />
'1 Reserved. <br />
'2 Minimize button. <br />
'3 Maximize button. <br />
'4 Help button. <br />
'5 Close button. <br />
Dim x As Integer<br />
For x = 2 To 5<br />
If Not (tbi.rgstate(x) = STATE_SYSTEM_INVISIBLE) And Not tbi.rgstate(x) = 0 Then<br />
count += 1<br />
End If<br />
Next x<br />
Return count<br />
End Get<br />
End Property<br />
<br />
End Class<br />
<br />
|
|
|
|
|
MSDN on the GetTitleBarInfo function.....
"If the function succeeds, the return value is nonzero."
|
|
|
|
|
Yeah, I been tweaking the code for a while now with no luck, anyone with a good understanding of interop, please comment, thanks.
|
|
|
|
|
AndrewVos,
Sorry, I was woring on it between other code so it didn't get my full attention or time, I think this solution should work now that I've had time to see what was going on. It works on my end.
'----------------------------------------
Imports System.Runtime.InteropServices
'----------------------------------------
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
Structure Rect
Public rLeft, rTop, rRight, rBottom As Int32
Public Function ToRectangle() As Rectangle
Return Rectangle.FromLTRB(rLeft, rTop, rRight, rBottom)
End Function
Public Overrides Function ToString() As String
Return "Rect: " & ToRectangle.ToString
End Function
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
Structure TitleBarButtonStates
Public TitleBarState As TBBStates
Public Reserved As TBBStates
Public MinState As TBBStates
Public MaxState As TBBStates
Public HelpState As TBBStates
Public CloseState As TBBStates
End Structure
Enum TBBStates
STATE_SYSTEM_UNAVAILABLE = &H1
STATE_SYSTEM_PRESSED = &H8
STATE_SYSTEM_INVISIBLE = &H8000
STATE_SYSTEM_OFFSCREEN = &H10000
STATE_SYSTEM_FOCUSABLE = &H100000
End Enum
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
Public Structure TITLEBARINFO
Dim cbSize As Int32
Dim rcTitleBar As Rect
Dim rgstate As TitleBarButtonStates
End Structure
Private Declare Function GetTitleBarInfo Lib "user32.dll" ( _
ByVal hwnd As Int32, ByRef pti As TITLEBARINFO) As Long
Public Shared Function GetTitleBarInfo(ByVal Handle As Int32) As TITLEBARINFO
Dim TitleInfo As TitleBarInfo
'Initialize structure
TitleInfo.cbSize = Len(TitleInfo)
GetTitleBarInfo(Handle, TitleInfo)
' *debug* the information we got back
With TitleInfo.rcTitleBar
System.Diagnostics.Debug.WriteLine(" (" & CStr(.rLeft) & "," & CStr(.rTop) & ")-(" & CStr(.rRight) & "," & CStr(.rBottom) & ")")
End With
With TitleInfo.rgstate
System.Diagnostics.Debug.WriteLine(.TitleBarState)
End With
'return with the TitleInfo
Return TitleInfo
End Function
'----------------------------------------------------------
My last test Return was:
Last DLL Error
(51,33)-(318,59)
STATE_SYSTEM_FOCUSABLE
whew.. Hope this helps...
|
|
|
|
|
Shweeet. Dunno how u got this working properly, well I havent reviewed it yet properly, but everything seems right.
Thanks alot Anonymous!
I actually resorted to GetWindowLong to check if the caption buttons r there.
Well done, ur a genius :>
|
|
|
|
|
Wasnt logged in there... Thanks so much for your work, Anonymous, and the last post was mine. Cheers mate
|
|
|
|
|
AndrewVos,
Thanks, it was interesting, and no problem, I don't log in a lot of times either.
progload
|
|
|
|
|
i have an application that I wrote about a year ago. Within this application I allow certain users to change the DB access for all users of the application on a given PC.
SaveSetting("DMaTS", "SQL_Server", "ServerName", gstrServer)
**where gstrServer is the name of the server)
This has worked without issue until recently when I have opened this code up and have added new functionality. Now the SaveSettings only works for the user that applied the DB Change. Is this change if bahavior something to do with some security patching?
If I do a registry check for the entry is lists under "Current User..."?
I am a bit puzzled by this change in behavior and am looking for an explanation of why, as well as any corrective action I should take to correct my code and coding habits.
Thanks in Advance.
mtognetti.
|
|
|
|
|
SaveSetting has always saved to HKEY_CURRENT_USER . I don't know what's changed, but this functionality wasn't it. Anything saved under CurrentUser is visible only to the user that saved it, not to anyone else.
If you need to save application settings that apply to all users of your application, then they should have gone under HKEY_LOCAL_MACHINE .
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
As I have done some further reading since posting this I have come to the same conclusion that you have.
Thank you for the validation. I will now redefine this to actually change/add the setting to HK_Local_Machine. This way I will actually get the functionality that I am expecting...all of the time.
Thanks again.
Mtognetti
|
|
|
|
|
Hi everyone,
I have found tons and tons of code on how to add users to the active directory, but I have not found much on how to set folder permission for these users. I have an FTP site that I use a batch to create 50 username and password combinations and then I add those to the active directory (currently by hand; working on code for autonomous). I then have to set all the user permissions to the folder that is reserved for each user. Everywhere I look there is very little discussion on how to do this automatically. Any help is VERY appreciated. Thanks!
Mike
Gaming at the GuildofBlades.com is the only way to really experiece the level 99 Soul-Sucking Sword!
|
|
|
|
|
Here is a sample code I would like to be able to cut in half. The Dim is the only difference. I want to connect to a different db - through web services - based on a command button clicked in Excel. I currently have the button set a property (thanks Dave) in the form but this is a bunch of repeated code (and this is one of the short segments). I would put just the Dim in the If statement but since I can't use it outside of the if the rest of the code has no definition.
Private Sub frmCJ_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dsOrg As DataSet
If m_ConnectionString = "prod" Then
Dim wsrv As New seoweb.Service1
dsOrg = wsrv.CJGetOrganization
Dim DV As DataView = dsOrg.Tables(0).DefaultView
With cbOrganization
.DataSource = DV
.DisplayMember = "organization"
.ValueMember = "organization"
End With
Else
Dim wsrv As New seodev.Service1
dsOrg = wsrv.CJGetOrganization
Dim DV As DataView = dsOrg.Tables(0).DefaultView
With cbOrganization
.DataSource = DV
.DisplayMember = "organization"
.ValueMember = "organization"
End With
End If
End Sub
|
|
|
|
|
Private Sub frmCJ_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim dsOrg As DataSet<br />
<br />
If m_ConnectionString = "prod" Then<br />
Dim wsrv As New seoweb.Service1<br />
dsOrg = wsrv.CJGetOrganization<br />
Else<br />
Dim wsrv As New seodev.Service1<br />
dsOrg = wsrv.CJGetOrganization<br />
End If<br />
<br />
'common stuff<br />
Dim DV As DataView = dsOrg.Tables(0).DefaultView<br />
With cbOrganization<br />
.DataSource = DV<br />
.DisplayMember = "organization"<br />
.ValueMember = "organization"<br />
End With<br />
End Sub
This is what I got out of your code. Simplifies it slighty
|
|
|
|
|
Does anybody know if it is possible to clear the ErrorProvider on ALL controls with one simple function?
ErrorProvider1.SetError([ALL Controls], "")
Thanks
Brad
|
|
|
|
|
No, but you could create your own,
This is what I use:
'--- hErrorProvider.vb -------
Public Class hErrorProvider
Inherits System.Windows.Forms.ErrorProvider
#Region " Component Designer generated code "
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Component overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<system.diagnostics.debuggerstepthrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container
End Sub
#End Region
Private _errorList As New ArrayList
Private _activeControl As Control
Public Shadows Sub SetError(ByVal control As Control, ByVal value As String)
If value = "" Then
If _errorList.Contains(control) Then
_errorList.Remove(control)
End If
Else
If Not _errorList.Contains(_errorList) Then
_errorList.Add(control)
End If
End If
MyBase.SetError(control, value)
End Sub
Public Shadows Sub SetError(ByVal value As String)
If _activeControl Is Nothing Then
Throw New Exception("Active control has not been set.")
End If
Call Me.SetError(_activeControl, value)
End Sub
Public Sub ClearError(ByVal control As Control)
If _errorList.Contains(control) Then
_errorList.Remove(control)
End If
MyBase.SetError(control, "")
End Sub
Public Sub ClearError()
If _activeControl Is Nothing Then
Throw New Exception("Active control has not been set.")
End If
Call Me.ClearError(_activeControl)
End Sub
Public Sub ClearAll()
For Each control As Control In _errorList
MyBase.SetError(control, "")
Next
_errorList.Clear()
End Sub
Public Function HasErrors() As Boolean
Return _errorList.Count > 0
End Function
End Class
|
|
|
|
|
Hi folks,
I have a kind of listview, with a couple of 1000 items.
Each item displays a bitmap of around 100x100 pixels.
Because it takes very long to make the bitmap, each item caches the bitmap instead of redrawing it over again.
But, because there are so many items, memory goes berserk (+200000 private bytes)
Each bitmap has a pixelformat of 32bppPArgb.
Because i want to keep the memory within bounds, i would like to change this to Format16bppArgb1555 or something.
But then i can't create a Graphics object from the bitmap (OutOfMemoryException).
Does anyone here have any ideas?
Thanks in andvance!
|
|
|
|