|
Well, the easy way to do it would be to have two different buttons, one on top of the other. When your application starts, hide the Delete button, by setting it's Visible property to False. When you have to change the functionality, set the Add button's Visible property to False and the Delete button's Visible property to True.
|
|
|
|
|
well thank u
Mr.Dave Kreskowiak
But i want to use it on the same button whn form is loaded at that time it should wrk in add mode and after i double click on listview items it goes in edit mode at that time the same add button should be visible as an delete button...thats the problem i m facing i need that it shld wrk on same buton...both add and delete no other button for delete has to be kept.....
so plz help..
thank u ...
|
|
|
|
|
nazimghori wrote: well thank uyou
Mr.Dave Kreskowiak
But i want to use it on the same button whnwhen form is loaded at that time it should wrkwork in add mode and after i double click on listview items it goes in edit mode at that time the same add button should be visible as an delete button...thats the problem i m facing i need that it shld wrkshould work !!! on same buton...both add and delete no other button for delete has to be kept.....
so plzplease help..
thank uyou ... Smile
try to use whole words, not sms-style!
simply change the button's text to "add" or "delete" in runtime - in your button-click-event check whether the text says "add" or "delete" and execute the appropriate code. Simple.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
thank you very much
|
|
|
|
|
His requirement is superficial and leads to a problem. The solution is a bad one in a production application. Localized apps will not have the same text in the button.Text property as in the inevitble code he will write.
Accepted solutions are to either
1. visually swap out the button with another, prewired button, or, less likely,
2. change the properties of the button, then rewire the Click event handler.
I go for the simpler solution.
Checking for the text as a "switch" does approximately the same thing as option number 2, but relies unreleliable information to do it.
The inevitable code he will write will consist of putting all the "work" code in the button handler (bad practice!) and throwing in an if statement to branch between two sections of code that really should be in their own methods.
|
|
|
|
|
hello every one
I m using sqlserver 2005 as an backend tool and vb.net as front end in my project now when i fire n update query
using datareader and cmd.execute nonquery method.
eg:-
obj.strexecutesql("update regi_mast set regi_numb='" + Me.txt3.Text + "'where regi_numb=" + strid)
obj.lfill(Me.lst1, "select * from regi_mast")
this strid is one label in form which is havng value of listview subitem number..
nw in catch block is having exception like:-
Conversion from string "update regi_mast set regi_numb='" to type 'Double' is not valid.
also i m a beginner..
so plz help me...
thank u...
|
|
|
|
|
nazimghori wrote: strexecutesql
nazimghori wrote: lfill
These are not .NET methods. Did you create these yourself?
nazimghori wrote: ("update regi_mast set regi_numb='" + Me.txt3.Text + "'where regi_numb=" + strid)
This is vulnerable to a SQL Injection Attack. Please use parameterised queries and read Tips on How to Prevent SQL Injection Attacks[^]
The reason for the issue is that you are enclosing the value for regi_numb in quotes making it a string. You should use parameterised queries to ensure that the correct data types are used.
|
|
|
|
|
thank u
lfill and strexecutesql they are the mehtod declared in a seperate class file and through that an object is passed in form for its use....
thanks again
|
|
|
|
|
How can I read jpeg's metadata in IPTC format?
Pouya
|
|
|
|
|
|
If Not (e.KeyChar >= "0" And e.KeyChar < "9" Or e.KeyChar = vbBack) Then
e.Handled = True
modified on Sunday, March 8, 2009 12:49 AM
|
|
|
|
|
WTF
|
|
|
|
|
"An unhandled exception occurred and the all reply to your post should be terminated."
Have some
|
|
|
|
|
again[^]
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Your IP address has been noted and your location triangulated. As you read this, a highly trained secret agent is on his way. If you do not stop your useless posting habits, he will stand behind you and release a highly trained ninja monkey. I cannot be held responsible for the ninja monkey's actions
|
|
|
|
|
Once again, you have post a snippet of code wihtout explaining anything about a problem you're having with it, or any other type of intelligent question.
|
|
|
|
|
You are an idiot. You post this sort of drivel daily. What if your boss finds CP ? What if he realises how utterly useless, even by Indian outsourcing standards, you are ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Looking to create a global hook to intercept WM_WINDOWPOSCHANGED messages. So far all attempts to create a hook always end up not functioning properly. I create the hook then filter out messages that aren't what I'm looking for, but it always seems to make all non-system processes that are running crash.
My Code:
Public Class WM_WINDOWPOSCHANGED
Shared Event WindowMoving(ByVal handle As IntPtr)
Shared hookhandle As Integer
Shared hookhandler As HookHandler
Private Sub New()
End Sub
Public Shared Sub CreateTheHook()
'If hookhandle = 0 Then
' hookhandle = User32Imports.SetWindowsHookEx(CInt(HookCodes.WH_CALLWNDPROC), hookhandler, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()(0)), CInt(0))
' MsgBox(hookhandle)
'End If
hookhandler = New HookHandler(AddressOf ChangeButtonHost)
hookhandle = User32Imports.CreateSystemHook(Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()(0)), hookhandler)
If hookhandle <> 0 Then MsgBox("hi")
End Sub
Shared Function ChangeButtonHost(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr)
If nCode >= 0 Then
Dim cwps As CWPSTRUCT = DirectCast(System.Runtime.InteropServices.Marshal.PtrToStructure(lParam, GetType(CWPSTRUCT)), CWPSTRUCT)
Dim winfo As New WindowInfo(cwps.hwnd)
If cwps.message = &H46 And WindowInfo.IsValid(cwps.hwnd) And winfo.ShowInTaskbar = True Then
RaiseEvent WindowMoving(cwps.hwnd)
End If
End If
Return 0 'User32Imports.CallNextHookEx(hookhandle, nCode, wParam, lParam)
End Function
End Class
Friend Class User32Imports
<DllImport("user32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
Friend Shared Function SetWindowsHookEx(ByVal idHook As Integer, ByVal lpfn As HookHandler, ByVal hInstance As IntPtr, ByVal ThreadId As Integer) As Integer
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
Friend Shared Function CallNextHookEx(ByVal idHook As Integer, ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lparam As IntPtr) As Integer
End Function
End Class>
EDIT: CreateSystemHook was my attempt at doing the hook code in C++, that also failed.
|
|
|
|
|
It's not going to work. You can't implement system-wide hooks inside managed code. You'll have to write a C++ "normal" .DLL to handle the hook, then expose an itnerface you can use to talk to managed code, like C# or VB.NET. .NET does not support the exports required of a .DLL to support a system-wide hook. It'll work for a "local" hook. That is, hooking your own application, but not system-wide. You can find Microsoft's documentation on it here[^].
|
|
|
|
|
Thanks for the response. I've looked at the MSDN docs for hooks, and created a C++ version, but I'm getting the same results.
|
|
|
|
|
|
Thats for the mouse and keyboard hooks right? Neither will work in this case.
|
|
|
|
|
Hey guys i'm building an application with a multi tab interface, i have a textbox above and a tabstrip below.
What i want is for the textbox to remember the entry of the active tabpage even after switching back nd forth b/w tabs, for example i want to able to create a new tabpage with a texbox entry "hello", and a second tabpage with a different textbox entry like say "world" but still same textbox and wen i switch b/w tabs, i want the textbox to still hold the textbox entry for each tab... Just like tabs in firefox browser... I tried creating instances of the textbox any time a new tab was created, but it did not work, all tabs still had thesame texbox entry.... Im really hoping u guyz find a solution cuz i've been tryin to solve dis prob for the past three days...
Note, am not creating a browser application and am pretty noobish.
I hope u guys get me.
Thanks in advance
|
|
|
|
|
The text box would presumably be outside of the tab control. In that case you can handle the event of the user switching tabs to update the text box.
sphlynx wrote: Im really hoping u guyz find a solution cuz i've been tryin to solve dis prob for the past three days...
...
I hope u guys get me.
It would be easier if you didn't use text-speak.
"Im" has an apostrophe "I'm".
"u" either means you've switched to Dutch or you are lazy. The word is "you".
"guyz" is incorrect. To form a plural in English you generally add an "s", never a "z".
"cuz" is just laziness. The word is "because".
"tryin" is again lazy. The word is "trying".
"dis" is more laziness. The word is "this".
"prob" is seriously lazy. The word is "problem".
Seriously, if I had a child that wrote like this I'd send them to a remedial class.
|
|
|
|
|
Thnks for d reply, tab switching is not the main thing here, wat i want is for d textbox to remember the text input entered wen tab1 is active, then wen u create a new tab, it clears the textbox and if another text is entered wen tab2 is active, it should also store it, then if u go back to tab1, the textbox should display the text input entered wen tab1 was last active and vice versa...
I dont think the use of proper english should be an issue here am not writing an essay or term paper, if u hav an answer to the question, pls kindly state it, instead of deviating from the issue at hand.
Thanks...
|
|
|
|