|
you can make a new button to minimize you form and hide the form minimize button...
so you can write some code in the new minimize button that you made
|
|
|
|
|
There is no event specific to the Minimize control button in the uppoer right corner of the form. You have to handle the form's Resize event, and in that code, check the WindowState property to see if it's been minimized.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Actually, there is a quite simple way.
Type the code below, where <code>; is the action you want when the form is minimized:
Private Sub Form1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
If Me.WindowState = FormWindowState.Minimized Then
<br />
End If<br />
End Sub
<br />
<br />
Please mail me with any questions or comments.<br />
<br />
Best Regards,<br />
Richard Faulkner
|
|
|
|
|
Hi there,
What is the utility of withevents keyword?
|
|
|
|
|
Hello
The withevents key word means that you can enable the catching of events in that object.
If you are accessing a class with events you need to insert that keyword to catch them.If not you can still access the methods, properties... but you won´t catch events.
'Main Form
Private WithEvents Catch_Event as new Test
Private Sub Test_Result (ByVal Value as Integer) Handles Catch_Event.Test_Result
End Sub
'Class Test
Public Class Test
Public Event Test_Result (ByVal Value as Integer)
Public Function StartEvent()
RaiseEvent Test_Result (10)
End Function
End Class
Hope it Helps
|
|
|
|
|
Hi i have doubt in roles using in vb.net...,
in my sqlserver for a paricular database,i created two application roles..and i given permission for those roles also..,
Now how to tell the roles in vb.net..,
(i.e) how to interact with those roles from vb.net codes...,
I dont know how to interact with those roles...,
so plz give me some idea..,if any sample codes will be there...,
it will be more usefull for me...,
Magi
|
|
|
|
|
You can't interact with roles. Roles are assigned to logins, and what login you use will determine your role, and your permissions on a database.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Ok in ur statement u told we cant interact with roles...,
So if i have 4 or 5 roles,each role have different,different permissions...,
In that case two different role users entering in same page...,
One user is guest so he can have select permission only...,
Another user is admin so he can do anything in that page...,
If we cant interact with roles then, how u can tell this user have this role like???????,
And how the form should be look...,
becoz in the same form i have all buttons(select,update,delete,add)...,But one user have only select permission and another user can have all permission..,
So how it will be play??????
Magi
|
|
|
|
|
Magh_M wrote: If we cant interact with roles then, how u can tell this user have this role like???????,
That's not the purpose of roles. Your site should enforce what user can do what. You can't write site around the idea that the database will tell you what users can't do, by blowing up.
Magh_M wrote: becoz in the same form i have all buttons(select,update,delete,add)...,But one user have only select permission and another user can have all permission..,
So how it will be play??????
You need to write your own permissions system, within your site.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 its based on user...,
And based on user my permission will be there..,
Then whats the need of roles?????,
Y they created such that one in sqlserver?????,
And y they given for the roles permission tab?????,
Actually some thing will be going on based on roles...,
If u dont mind u can explain my doubts?????
Dont think i am asking more doubts like...,
Actually i like to know about the concept, atleast some what depth..,
thats y so plz help me.....,
And one more i saw in msdn in that they told want to declare system.web.security...,
If i declare that one also i am not getting roles method in my form...,
What to do for that...,
-- modified at 9:19 Thursday 12th April, 2007
Magi
|
|
|
|
|
i need a groupDataGrid control in visualbasic
|
|
|
|
|
What ur asking???
Group dat grid like that any tool is there in vb????,
ask ur ques clearly...........
Then only we can able to help ur probs.....
Magi
|
|
|
|
|
I need a Ferrarri.
Seriously, what are you looking for ? Is this VB.NET ? What version ? ASP.NET or Winforms ? What do you mean by groupDataGrid ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Index was out of range. Must be non-negative and less than the size of the collection
________________________________________
Hi,
I've a form and the form is working fine also. But my problem is
Whenever I closed the form. I'm getting two errors.
1.Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
2.Arithmetic overflow error converting varchar to data type numeric.
The statement has been terminated.
Events are :
Private Sub btnFilClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFilClose.Click, btnBrowClose.Click
'This event is used to close the form
Try
Me.Cursor = Cursors.WaitCursor
Me.Close() ' I'm getting the error on this line
Me.Cursor = Cursors.Default
Catch ex As Exception
Me.Cursor = Cursors.Default
MessageBox.Show(ex.Message)
Finally
Me.Cursor = Cursors.Default
Me.Close()
End Try
End Sub
Private Sub forms_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
'This event will be fired automatically whenever form will be closing
Try
Me.Cursor = Cursors.WaitCursor
If MessageBox.Show("Do you want to close this form", Me.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
'If user press Yes then Form will be closed
Me.Cursor = Cursors.Default
e.Cancel = False
Else
'If User press No the Form will be not closed
e.Cancel = True
End If
Me.Cursor = Cursors.Default
Catch ex As Exception
Me.Cursor = Cursors.Default
MessageBox.Show(ex.Message)
End Try
End Sub
Please help me
Thanx in advance
Ashok
|
|
|
|
|
The error you are getting occurs when accessing an array or similiar collection. The code provided shouldn't throw that error. I used the code you have shown here and it works. Try stepping through you code. Add a break to the button event and step through your code to see what is actually happening.
|
|
|
|
|
sir/madam..
i want to make my program when it minimize it will appear at system tray...
how to make that..
thanks...
|
|
|
|
|
Just use a NotifyIcon . If you need further help, this article might help.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
Thanks .This aticle helped me a lot.
|
|
|
|
|
|
Hi, I have a treeview control on a vb form and have subclassed the form. I want to be able to highlight/select an item when the mouse is moved over a treeview item without giving the treeview the input focus. I've trapped the WM_NOTIFY message and checking for the NM_SETCURSOR code. I like to know how I can get the mouse position from the NMMOUSE structure and sending a TVM_SELECTITEM to the treeview to select the item. I've output what x & y is from the NMMOUSE but x seems to always be zero. Can dwHitInfo be used somehow?
Friend Function WndProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim notify_header As NMHDR
Dim mouse_info As NMMOUSE
Dim tvhti As TVHITTESTINFO
Dim Ret As Long
Select Case uMsg
Case WM_NOTIFY
'Copy the WM_NOTIFY details into the notifiy_header structure.
CopyMem notify_header, ByVal lParam, LenB(notify_header)
If notify_header.hwndFrom = m_Frm.tvControl.hWnd Then
If notify_header.code = NM_SETCURSOR Then
CopyMem mouse_info, ByVal lParam, LenB(mouse_info)
Debug.Print "mouse moving x=" & mouse_info.pt.x & " y=" & mouse_info.pt.y
'tvhti.pt.x = mouse_info.pt.x
'tvhti.pt.y = mouse_info.pt.y
Ret = SendMessage(m_Frm.tvControl.hWnd, TVM_HITTEST, 0&, tvhti)
If Ret > 0 Then
Ret = SendMessage(m_Frm.tvControl.hWnd, TVM_SELECTITEM, TVGN_CARET, tvhti.hItem)
End If
End If
End If
End Select
WndProc = CallWindowProc(m_OrigWndProc, hWnd, uMsg, wParam, lParam)
End Function
|
|
|
|
|
lee23 wrote: I want to be able to highlight/select an item when the mouse is moved over a treeview item without giving the treeview the input focus.
That sounds awfully messy and inconsistent with how user expect the TreeView controls to work. But to clarify, you want to select TreeView items just by moving the mouse over them?? Not by clicking on them??
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi Dave, yes that's correct.
|
|
|
|
|
OK - Yikes. That's not good. You'd have to leave the mouse on the node you want and not move it at all. I'm one of those people who clicks on something and then reads something else with the mouse pointer following where I'm looking. In order to keep the currently selected item in the TreeView picked, you'd have to slide the mouse off to the left or right of the TreeView while maintaining the mouse pointer on the same line as the item selected.
Are you sure this is what you want?
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
what i'm trying to create is a combobox but instead of dropping down a listbox, it drops down a treeview. So, i have a textbox and button on a usercontrol. when the button is clicked it shows/hides the treeview that's on a vb form. So, I want to replicate the behaviour of a standard combobox of style dropdown where when you drop down the list the input focus remains on the textbox but when u move the mouse over the listbox, the item the mouse is on is highlighted.
|
|
|
|
|
Ok. That explains a lot.
You can highlight the item that the mouse is rolling over, but you still have to click on it to select it. Selection by rollover is notoriously difficult to control because the user has to know that the mouse must move off the control only to the left or right to maintain the selection.
I'm really short on time right now, so there will be more to follow....
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|