My code has a raw_input in it - when I press Enter, it completely ruins the code which says that the string index is out of range. The annoying thing is that if you don't press Enter and type something in, it works perfectly fine. So my question is - how do you make it so nothing happens if you leave a raw_input blank?

Member Avatar
Member Avatar
+0 forum 2

I'm trying to select items from the listbox when pressing Enter on the selected item. Here is what I have tried so far: Private Sub ListBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ListBox1.KeyDown Select Case e.KeyCode Case Keys.Enter ListBox1.SelectedItem = ListBox1.PerformMouseClick() End Select End Sub

Member Avatar
Member Avatar
+0 forum 1

Good day, I must be blind .. I am developing my first "Visual Studio" desktop application. My apps are normally always Internet Apps. I have about 20 text boxes, but I want to give the user the ability of pressing Enter, and "defaulting" to the Enter button on the screen. I cannot figure out how to do this .. I have the KeyDown event working for one text box, but it makes no sense to copy this to every object. Thank you very much, Mark

Member Avatar
Member Avatar
+0 forum 2

In MySQL I have created database "[B][COLOR="Red"]mydata[/COLOR][/B]" with the table "[B][COLOR="red"]contacts[/COLOR][/B]". The fields are as follow: [B][COLOR="green"]ID[/COLOR][/B] (Primary Key) (INT(10) [B][COLOR="green"]Name[/COLOR][/B] VARCHAR(45) [B][COLOR="green"]Title[/COLOR][/B] VARCHAR(45) [B][COLOR="green"]Address[/COLOR][/B] VARCHAR(45) [B][COLOR="Green"]Comments[/COLOR][/B] TEXT Based on info at [url]http://www.webmasterforums.com/php-development/1683-php-form-entering-data-mysql-database.html[/url] I have created following two files: [B][COLOR="green"][COLOR="Red"]new_record.php[/COLOR][/COLOR][/B] [CODE]<? $usr = "myusername"; $pwd = "mypassword"; $db = "mydata"; $host = "localhost"; # connect to database $cid = mysql_connect($host,$usr,$pwd); mysql_select_db($db); if (mysql_error()) { print "Database ERROR: " . mysql_error(); } ?> <html> <head> <title>Insert New Record</title> </head> <body bgcolor="#ffffff"> <h2>Insert New Record</h2> <? # this is processed when the form is submitted # back on to this page (POST …

Member Avatar
Member Avatar
+0 forum 1

I have a form containing a tab control, which itself contains five tab pages. These tab pages contain lists, textboxes, and other controls that I update when the user enters the relevant page. One of the tab pages contains a textbox which I fill with information from an external text file. This information is a 'log' of changes made to documents sorted chronologically so that the most recent change is found at the bottom of the log. When the user enters this tab page, the textbox is filled with information from the external text file (it does this every time …

Member Avatar
Member Avatar
+0 forum 2

Hello, So I'm trying to make a program to auto bump my facebook posts. I have made it log in etc but there is no 'post' button on facebook, you have to press enter on the keyboard. How can I make the program press enter in the box and make it work? The code I currently have that enters the message but doesn't press enter to send the post is: Dim allelements As HtmlElementCollection = b.Document.All For Each element As HtmlElement In allelements If element.GetAttribute("title") = "Write a comment..." Then element.SetAttribute("value", "bump{enter}") End If Next Any help is very appreciated! …

Member Avatar
Member Avatar
+0 forum 3

Hello, I have several textboxes and it is possible to write something in one of them and then without losing the focus I could or would save the input. But there is no FocusLost and therefore the TextChanged event doesn't fire. How can I save the input of one these textboxes if enter or tab isn't pressed? Thanks for help

Member Avatar
Member Avatar
+0 forum 4

Hi there. I developed a program that creates Data Reports using this way : [Click Here](http://www.vbtutor.net/vb6/lesson40.html) But instead of using "Microsoft Jet 3.51 OLE DB Provider", I used "Microsoft Jet 4.0 OLE DB Provider" because when I used "Microsoft Jet 3.51 OLE DB Provider" it couldn't connect to the database when testing the connection. But when I used "Microsoft Jet 4.0 OLE DB Provider" it worked perfectly. It worked fine until recently I tried to run the application and it gives this error : [Click Here](http://i46.tinypic.com/24b9g2d.png) I enter all the data the way it is shown in the picture above, …

Member Avatar
Member Avatar
+0 forum 2

Is there any standard function in gcc that is equivalent to getch() so that I can read the input without hitting enter key?

Member Avatar
Member Avatar
+0 forum 6

Im writting a very simple command-line. I want the > Charecter to come up every time a command ha finished what it's doing (easy) AND when the user presses enter with nothing on it. For example ($ is currssor) I want this: [CODE]> >$[/CODE] Not this: [CODE]> $[/CODE] How would I go about doing that?

Member Avatar
Member Avatar
+0 forum 8

I am looking for a replacement for _getch(); Yes I have seen other threads like this, but they do not really satisfy my need(And I do not want to waste my time trying to write one in Assembler, as it isn't my strongpoint). I need something that is exactly like _getch() in that you do not have to press enter. I would probably use it for passwords, and menu's, so it would need to be able to work like _getch(mycharhere); works. I have tried WM_KEYDOWN but I do not really know how to use it properly.

Member Avatar
Member Avatar
+0 forum 11

Hy again , I have another problem now , I have an application with a jTabel , you can double click a cell and you can change the value that is inside it , after you changed the value inside the cell and hit enter the value i enterd remains but i need to hit again enter key to return me the row and column that i need to save later in the database. My question : How can i save the data from the cell after editing was done without needing to hit ENTER key again? My code is …

Member Avatar
Member Avatar
+0 forum 7

[B]!USING PYTHON 3.1![/B] [B]USING WINDOWS[/B] I never thought it could be so simple. However I should have clarified that it's a [B]1 character[/B] input. But the general idea is the same. Someone suggested that I explain what is going on better, so I'm going to do that. The function 'getch()' waits for a keyboard hit. But the reason that it has to be converted so many times in the line '(str(list(str(getch()))[2]))' is because getch() has to be annoying and add a b(It's a nonetype) before everything, and to be even more annoying, it's not a string (grrr)... So we have …

Member Avatar
Member Avatar
+0 forum 11

On a form, I want to jump to the next tabindex when pressing the 'enter' key. The script that should do the thing, should look like this (the tabindex is generated dynamically and the code is simplified): [CODE] <form id='MyForm'> <?php $tabindex = 1; ?> <input class='pts' type='text' id='<?php echo $row['id']; ?>' tabindex='<?php echo $tabindex; ?>' onkeypress='convertEnterKey(this);' /> <?php $tabindex++; ?> </form> [/CODE] [CODE] <script type="text/javascript"> function convertEnterKey(obj) { var k; if(window.event.which) { k = window.event.which.keyCode; } else { // needed for IE k = window.event.keyCode; } if (k == 13){ nextTabIndex = obj.tabIndex + 1; for(i=0;i<document.MyForm.elements.length;i++){ if(document.MyForm.elements(i).tabIndex==nextTabIndex){ document.MyForm.elements(i).focus(); break; …

Member Avatar
Member Avatar
+0 forum 1

HELP!! can someone please help me, because i need to create a game in which i have to count how many times i've pressed enter in a matter of 1 minute.

Member Avatar
Member Avatar
+0 forum 5

Hi, I`m new here and, of course, have a small problem. I need to create a program with VC++ 6 Builder where: Press ENTER once - open picture, Press ENTER Twice - start a music. I can`t figure out how to check if user press ENTER twice, can anybody help me? My Code: [CODE] void __fastcall TForm1::ListBox1KeyPress(TObject *Sender, char &Key) { switch( Key ) { case 'VK_RETURN': { atidarytpav(); } break; } [/CODE] Sry for my bad English

Member Avatar
Member Avatar
+0 forum 12

Hey guys, This is my first official post on DaniWeb :) I am new at programming in C++ using visual studios, and right now I am fooling around with storing user input into Arrays. I am having a problem with my code, using an array size of 3 to store the users input into the first 2 spots [0 and 1] and then making a calculation in the 3rd spot[2]. Here is my code: [CODE]#include <iostream> using namespace std; int main() { double userInput[3]; //array can only hold *3* elements cout<<"Enter the number of cars you wish to buy: "; …

Member Avatar
Member Avatar
+0 forum 4

How can I prevent the beep sound when I use the SendKey command in NumericUpDown1 Box? Here is the code: [CODE] Private Sub NumericUpDown1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles NumericUpDown1.KeyPress Static SAME As Short = TB2 TB1 = SAME - NumericUpDown1.Value If e.KeyChar >= "0" And e.KeyChar <= "9" Then SendKeys.Send("ENTER") End If TextBox1.Text = TB1 End Sub[/CODE]

Member Avatar
+0 forum 0

So my problem is that, i have a text area with 3 rows. Its a part of a chat application which receives text from a user. I want to send the text and clear the text area as soon as the user presses the enter key. Now the problem is that whenever user presses the enter key the cursor goes to next line(row) and then on clearing the text area it comes to first, so it looks weird to a user that the cursor goes to next line and then comes to first. So I want to stop the cursor …

Member Avatar
Member Avatar
+0 forum 4

I'm making a program that accept 1 character long strings (and ignores spaces " ") until a user presses return/enter. So far I have, [CODE] int main(){ char expression[1]; while ((scanf("%s",expression)) != EOF){ //code } return 0; } [/CODE] it is assumed that the user is entering single digit strings (such as "a 1 2 3 d"(enter)) its seems to not like the while condition as it will keep accepting input even after I hit enter. I have tried using -1 instead of EOF but its the same output. Any ideas?

Member Avatar
Member Avatar
+0 forum 9

Hi Guys, Probably a simple one but im struggling to find it in VS 2008. How do you enable a VB program to allow a user to press enter rather than click on the button? I have a text box which the user types a number and then clicks a button which runs the script. I want the user to be able to either press enter once they enter a number or click on the button. I thought there was a setting in properties to do this but I am struggling to find it - also no joy searching online …

Member Avatar
Member Avatar
+0 forum 6

Hi, I'm pretty sure this would be something I'd need javascript for. What i want to do is to recognize when a user presses the enter key while active on a text area and to insert a new line

Member Avatar
Member Avatar
+0 forum 4

Hi. This may seem simple to most but has consumed 3 days so far and a bit of $$ trying to learn simple how to use Enter as a Tab (Yes I know it is a Fau-par but I need it regardless). The idea is to move the focus to the next TextBox (don't worry about the Case 38, 58 etc too much I). I have 6 large books on VB.NET 2003 and have been googling for days with no joy. Please help. Thank you. My Code: [CODE]Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '(Unrelated …

Member Avatar
Member Avatar
+0 forum 1

Dear Experts DataGridView has 3 columns as Sno----name----marks While entering data, if sno column is empty and user press Enter or Tab then Focus must go to me.textbox1 Please help

Member Avatar
Member Avatar
+0 forum 3

Hi I have a textbox and a listbox. If i write something into the textbox and press the enter key, i would like the content of the textbox to appear in the listbox. What is the best way to do it? Thanks in advance

Member Avatar
Member Avatar
+0 forum 3

The End.