Jump to content
Xtreme .Net Talk

mhsueh001

Avatar/Signature
  • Posts

    41
  • Joined

  • Last visited

About mhsueh001

  • Birthday 07/18/1969

mhsueh001's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. While I agree it maybe overkill, I believe it maybe the only way to go so I can encapsulate everything into my control, without forcing another coder to code the requirements into their code. It also modularizes it. I've got it working and found my solution here: http://www.developer.com/net/net/print.php/11087_2193301_1
  2. Ok, this is basically the direction I started heading. How do I go about this?
  3. Hi Iceplug, I'm not asking to hog all of the keystrokes. Here is my problem. Our company has tried to achieve a paperless office. And for a company that does data entry, this is no easy task. Teams are developing individual control modules. Mine is a composite control that is to display a scanned image. A document that must then be read by a data entry person, interpreted, and data then needs to be entered in other people's controls. There are multiple controls on a single form. The problem is that my control, which displays the image must allow a data entry person to scroll through the page. They need to be able to adjust the image size so they can read the document and move through the image. They do not like the mouse. Data entry people prefer all keyboard strokes because it's faster for them. So to toggle through the page, I've written some methods in my control to move up and down, left and right through the page. However I need to be able to move through the page WITHOUT requiring my control from having the focus. My control only displays the image. Other controls are responsible for handling the data entry. I would prefer not to do it at the form level because my "document viewer" is used on several data entry forms and to have to code the same repetitive keydown event for each form doesn't make sense, not to mention the fact that that's tasked to another person, and it creates a distinct problem of not being object oriented. My control, must capture all keystrokes, and determine if it's a keystroke to move the image up, down, left, right. (Basically hoping to assign these to function keys or keyboard combinations.). Anyways, that's my problem, which is why my control needs to receive all the keystrokes and determine if it's one of the key's pressed. Unless you know of a better way to trap an exact key such as F4 being pressed. Any solution?
  4. Hi RudeYute If this is the case, then my first piece of code should do the trick. It goes through each item in the list box and performs the action it finds. It doesn't matter what what is in the list box. The code I wrote basically starts from the top of the list box and moves down through the list. Each time it goes through and finds the action that it must perform through the if...then statement. What you must do is code an action that is added to the list. If your list has Up, down, left, right. Then you must have a corresponding if...then for each of the actions. If you don't have an if...then statement for that action, that action will be ignored. Basically my first code listing does this. 1. Step through each item in the listbox. (do while ...) 2. Analyze the action that we are asked to perform (if...then) 3. Perform that action (the block within the if then ... end if) 4. Retrieve the next item on the list and go back up to 1.
  5. Hi RudeYute, First off, either your explaination is not correct or your code is not correct because the logic of the two don't match up. So I will do a best guess at explaining what I think you want, and you can correct me if I'm wrong. 1. I believe you're saying you've got a list box with a list of items in it. (I'm assuming these's aren't buttons as you've indicated) 2. You want an external button, when pressed, to analyze each of the items in the list box and perform an action if that item exists in the listbox. (this is for all items, and not just the selected one in the list box???) What you need to do is go through the list of all the items. Dim intDummyCounter as integer intDummyCounter = 0 'As long as there are items in the list box perform an action Do while intDummyCounter < Me.ListBox1.Items.Count If me.ListBox1.Items(intDummyCounter) = "Up" Then 'Perform the action for the "Up" ElseIf me.ListBox1.Items(intDummyCounter) = "Down" Then 'Perform the action for the "Down" '... etcetra End If 'Increment to the next item in the listbox intDummyCounter = intDummyCounter + 1 'Or simply intDummyCounter += 1 Loop If you only want the selected items you can loop through the SelectedItems list instead of the full list. (I placed ???? in my statement above because I believe this is what you really want) ie. Do while intDummyCounter < Me.ListBox1.SelectedItems.Count 'Do the check on the selected Items If me.ListBox1.SelectedItems.Items(intDummyCounter) = "Up" Then '... etcetra End If Loop
  6. So basically you're saying I need to do an Addhandler and add the keydown event to every control on my custom control? This appears to work when the control is in focus, but I need to catch this event even when the control is not in focus. Any other ideas?
  7. Actually what you wrote is exactly what data binding is. Data binding binds information from a datatable (or the 0th datatable of a dataset) to a control. I believe what you're missing is the understanding that what you are binding to the text box is not the database table, but to disconnected copy of information in that table. Any changes you make to the data table aren't applied to your database table until you execute a command to perform those changes. There are a variety of ways to do this. Using the least amount of thought, Microsoft developed an SQLCommandBuilder, I believe oledb has a counter part as well. It writes the sql command for updating your table with the changes that were made to the data table. Check out Microsoft's own explaination: http://support.microsoft.com/kb/308055/EN-US/
  8. I'm trying to create my own form control. Went through all the File->New->Project, selected Windows Control Library. I want to capture if a function key is depressed and I tried both the KeyDown event and the Key Press event. Private Sub UserControl1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown 'My Code here End Sub Private Sub UserControl1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress 'My Code here End Sub However when run the control in a form, neither event is being captured. What am I doing wrong? I've tried putting break points at the top of the two delegates above, but the code never enters and runs. Help!
  9. An update for this post. Thanks Hamburger1984, this works great. Just to add an additional note, for multiple image files, the routine has a memory leak. The fix should be before you try to load up the new image, make sure you dispose of the previous one. If Not Panel1.BackgroundImage is nothing then Panel1.BackgroundImage.Dispose() End If
  10. Nope, that didn't work I'm already using the Onclick event to execute the vbscript routine. Also I'm using a HTMLbutton because the script I'm trying to run is for an activex control. thanks though.
  11. Is there a way to run both a vbscript sub and a codebehind method with only one button click? I've got a button that needs to runs some client side code, then run some server side code. Any help would be appreciated.
  12. Is there any way to get the values of a variable from the vbscript to a method in the codebehind? I have an activex control that runs client side. The activex control runs a number of times, and execution is controlled by a vbscript. I've got a counter in the script that counts number of times it was executed. Now I need to get that value into a routine in my codebehind after the user hits a submit button. Is this possible? (I would think it should be) Anyone know how to do this? Thanks.
  13. I found this on the web: Add the following line to your page's Load event, replacing "btnSearch" with the name of your button. It uses a hidden Page method called RegisterHiddenField. Page.RegisterHiddenField("__EVENTTARGET", "btnSearch") Note: Intellisense doesn't show this event/method so when you type Page.RegisterHiddenField (RegisterHiddenField doesn't show up in the list. However after you hit the parenthesis it does shows the parameters necessary)
  14. As a note: The syntax in your Page_Load should be myID.Attributes.Add("href", "default.css") 'At least that's the syntax in VB.NET Sweet, that works well and keeps me from that headache. I no longer see the style sheet being applied instantly as I work in Design View, which I liked, but I'd rather work this way than have to remember to change the & back to & each time. Thanks for your solution!
×
×
  • Create New...