|
Yes that makes sense. I have just tried a messagebox which works OK as it bring a new messagebox for every item. Is there anyway I can pause the loop, and proceed at the click of a button onto the next loop?
Thanks
|
|
|
|
|
You could just add the information to a ListView using columns. But if you really need to do something like that, then try something like this:
NumericUpDown control containing number of items in the collection
When ValueChanged event fires, get item with index NumericUpDown.Value
Use the members of the item to fill in the controls
It's not perfect (IndexOutOfRangeExceptions unless you fiddle around with the NumericUpDown.Maximum property), but it should get the job done
|
|
|
|
|
Hello,
I can't seem to get the numericupdown to work?
How can I put each loop in a separate columned listview?
ta
|
|
|
|
|
Hi,
I suggest you go to the bookstore, have a look at a few VB.NET tutorial books, pick the one you like most and work your way through it. In one weeks time you will learn much more than you would by asking hundreds of questions here. Get the basics first, then start experimenting, while asking informed questions.
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
|
|
|
|
|
You're basically trying to pause a loop, which, as you've found out, doesn't work very well. The solution is to use an appropriate layout of controls (something that would give you a tabular layout), or to not use a loop at all, but just should the selected card information accessing the data stored in an array fashion, and retrieved by index.
|
|
|
|
|
hi everybody..
i m having an ADD button in my project which function as adding values from database nw i want to change
its caption so that i can use it as a DELETE button for the functionality of deleting frm database
this has to be done on same button...i m having the functionality clear in my project jst need to knw how to use it on same button
plz help
thank u...
|
|
|
|
|
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[^].
|
|
|
|