|
I am a newbie Just try this
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
e.Handled = True
End If
End Sub
|
|
|
|
|
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Chr(13) Then
'event
End If
End Sub
ICQ:258-235-734
|
|
|
|
|
Hi,
I used this:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Chr(13) Then
'event
End If
End Sub
--> but it didn't work in my application
is there some property of the textbox that must be true or false to use this?
I can hit any other key and it works fine
but when i hit enter he does not go to this procedure
I use VS2005
what could i do, please help?
Thanks
Alwin
|
|
|
|
|
Never mind I solved it myself!
When i put off the Acceptbutton property of the form
it was OK!
Thanks Anyway
A.
|
|
|
|
|
That's Right
ICQ:258-235-734
MSN:msnadair@hotmail.com
|
|
|
|
|
Basically, what I am aiming for is to be able to take the current coordinates of the mouse onscreen and emulate a mouse click at that location by pressing a key on the keyboard.
I'm pretty much lost on locating the mouse and sending a click. Also, this needs to be able to send the click when other windows have the focus, and I don't know how to do that.
I've tried searching for this, but all I get are instructions in C#.
Thanks for taking the time to read this.
|
|
|
|
|
Hello, I am very new to Visual Basic / Visual Studio 2005 Pro and was wondering if anyone would be so kind to help me construct my first program..
I am using Microsofts sample Nwind.mdb database (With Customers and Orders in the data source window).
When I open my form I would like it to show 3 boxes - 1.The Order number box, 2.The Customer box and 3.The Freight box.
When I enter an order number and press enter it will populate the other 2 boxes.
Sorry if you get this questions all the time but the 'help' section is not helping me!!
I'd appreciate any help at all.
Thanks very much
--------------------------------------------------------------------------------
John C
-- modified at 16:56 Thursday 11th May, 2006
|
|
|
|
|
hi john,
populate the other 2 boxes u need to write code to extract data in tow boxes on command button click event , after writting code on command button set the Acceptbutton property of form e.g ( Acceptbutton= cmdClick), so after setting this property when u press enter key it will populate the other 2 boxes.
regards,
prasanna karandikar
prasannak5@hotmail.com
|
|
|
|
|
many thanks for that prasanna,
I have been able to set the Accept button of the form so that when I click enter in the job number box I can make the text in the other box change (I made it change to 'john') but I have absolutely no idea how to extract data from a database.
This was my code for the text change...
---------------------------------------------------------------------------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
EmployeeIDTextBox.Text = "john"
End Sub
---------------------------------------------------------------------------------------------
Any chance you (or anyone else) could show me how to extract data from the database?
Thanks
John
|
|
|
|
|
I am a newbie....
Pls ignore this is a wrong solution
You need to pass the order number in order to get the Customer and Freight details...
orderNo= comboBox.selectedValue
SQL code could be: select customerName,Freight from the "TableName" where order no='" & orderNo & "' orderBy customerName
|
|
|
|
|
Hello,
I have a small app that reads in a text file line by line. How do I take each line of text and dump it into an Excel Worksheet?
<br />
Do<br />
inputLine = sr.ReadLine<br />
If Not (inputLine Is Nothing) Then<br />
<br />
strColumn1 = inputLine.Substring(38, 28).Trim<br />
strColumn2 = inputLine.Substring(66, 12).Trim<br />
strColumn3 = inputLine.Substring(78, 1).Trim<br />
strColumn4 = inputLine.Substring(79, 4).Trim<br />
strColumn5 = inputLine.Substring(90, 7).Trim<br />
strColumn6 = inputLine.Substring(99, 2).Trim<br />
strColumn7 = inputLine.Substring(102, 2).Trim<br />
strColumn8 = inputLine.Substring(108, 3).Trim<br />
<br />
'here I would like to take the values of my Columns and create a CSV file or write the values of my columns to a blank Excel worksheet...<br />
<br />
End If<br />
Loop While Not (inputLine Is Nothing)<br />
Thanks in advance,
Rashar
|
|
|
|
|
Hi, all:
I've been around VB for a while, but am new to .Net and accessing DLLs. I'm currently working on a project in VB 2005 Express, and am having trouble executing functions contained within a DLL. Part of the problem (I expect) is my inexperience with terminology, as I can't seem to find anything in the help on Google that seems to apply. Here's the scenario:
I have an application that needs to open a CSV file in one format, and write selected fields out to a new file in a new format. There will be many input and output formats (many that I have not yet concieved of) so I thought I would place the reading/writing routines in external files. This way, when a new format comes along, I just have to write a new DLL, and through the configuration files, call that DLL. This way, the core app that handles opening of files, specifying default directories, user interface, etc. does not have to be recompiled each time I come up with a new output format.
I used VB 2005 Express to create a DLL project called iclocalio (thus, iclocalio.dll). Within that file are two functions, GetDataFromLocalFile, which is to be called from the core app, and GetICDataFromString, which is called from the first function. GetDataFromLocalFile returns an array. (BTW, I have already tested the logic by including these functions in my core app - they pull the data as expected, so I have since moved them out to a DLL file where they will hopefully take up permanent residency).
In the core app, I expect to call GetDataFromLocalFile, passing a filename string as an argument, and assigning the result to an array, a la:
arData = GetDataFromLocalFile(ByVal sFileName As String)
The problem is that I have no idea how to tell my app that this DLL exists, or that there is a function inside of it that I can call. Any help on this is appreciated. Even if it's along the lines of 'what you're trying to do is [insert correct terminology here] so see this MS help topic: xxxxx'.
Thanks in advance!
:Rich Lohman
|
|
|
|
|
Basically, you're looking to write a plugin framework. Search the articles for plugins, or just click[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks, Dave. Most of the content surrounds C#, but at least I can do some more googling using the 'plugin framework' keywords.
Richard::Lohman()
|
|
|
|
|
Have you tried adding your DLL as a reference to your project? Should be all you need to do if the DLL was written with a .Net language.
Steve
|
|
|
|
|
Steve:
I have not, but this sounds interesting. I'm using VB 2005 Express for both the core app (GUI, file/directory selection, etc.) and the DLLs (data import/export), so this may be an option.
[Rich plays in VB for a while]
So, after adding a reference to the project for one of the DLLs, all I need to do, then is call the function located in my DLL from my core app?
Richard::Lohman()
|
|
|
|
|
That is essentially correct.
I have an application using a GPSEngine. The DLL code for the engine is in a namespace called MACRONAV (MACRONAV.GPSEngine). I add a reference to the DLL by right clicking the project name in the project explorer or going to the Project/Properties/Reference tab.
In my code I declare the object with Public WithEvents GPS As MACRONAV.GPSEngine . Now I can call the procedures in the DLL with the standard GPS.<proc name> syntax.
-- modified at 18:46 Thursday 18th May, 2006
|
|
|
|
|
My Solution to This Problem (with help from arcticbrew)
Main Application (Form1) below is the executable app, written in VB 2005 Exp. It calls routines stored in external DLLs. The DLLs are also written in VB 2005 Express, using the Class Library template. The idea is that if a library needs modification, we should not have to recompile & redistribute the main application. Likewise, if the main application requires modification, we should not need to recompile/redistribute the DLLs that control data file interaction.
MAIN APPLICATION
----------------
Public Class Form1 'The main form in the .EXE application
...
Public obj As New iolibrary.LocalIO
Declare Auto Function GetDataFromFile Lib "iolibrary.dll" (ByVal filename As String) As Array
Declare Auto Function WriteDataToFile Lib "iolibrary.dll" (ByVal arraydata As Array, ByVal filename As String) As Integer
[other functions/subs/events as required...]
Private Sub cmdGetData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGetData.Click
'This sub makes a call to a function stored in a DLL (GetDataFromFile()) that
'opens a predefined file (sFileName), gets data from it, stores that data in an
'array, then returns the array for further processing.
[data processing...]
arInData = obj.GetDataFromFile(sInFileName)
[data processing...]
End Sub
Private Sub cmdVendorToLocal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdVendorToLocal.Click
'This function takes data stored in an array (arOutData), and passes it, along
'with a predefined file name (sOutFileName) into a function stored in a DLL
'which writes the data out to that file. It then returns the number of rows
'written.
[data processing...]
iRecsWritten = obj.WriteDataToFile(arOutData, sOutFileName)
[data processing...]
End Sub
End Class
DLL FILE
--------
Public Class LocalIO
Public Function GetDataFromFile(ByVal sFileName As String)
[data processing...]
Return arInData
End Function
Public Function WriteDataToFile(ByRef arData As Array, ByRef sOutFileName As String)
[data processing...]
Return iNumRecsWritten
End Function
End Class
Thanks all for your help.
Richard::Lohman()
|
|
|
|
|
hi. i have a mdi form with a list box. menu and toolbar on it.i want to open a child form to cover go below the toolbar and cover the list box below.
However when i load it, it ends up behind the listbox and if i send the listbox back, when i close the child form the listbox is nowhere to be found
what should i do??
|
|
|
|
|
This is happening because the child forms are rendered inside another control, called MdiClient, IIRC. Your missing ListView is sitting behind that MdiClient control, which is docked inside the entire client area of the MdiParent form.
Basically, what you isn't really possible without tracking if there are any child windows open. What you're going to have to do is send the ListView control to the back when there are child windows open. Then, when the number of child windows falls to 0, bring the ListView to the front.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi guys, anyone know how to connect to an SSL FTP Site from vb.net.
Thank you
-- modified at 17:12 Thursday 11th May, 2006
|
|
|
|
|
I have written a program that will print data to a preprinted form. This program is installed on three different computers and this form will be printed from three different types of printers. A laser jet, a inkjet, and a 3-in-One. The problem I am experiencing is each printer starts printing in a different spot on the page. I need each printer to start printing in the exact same location. Any suggestions?
brensall@yahoo.com
|
|
|
|
|
You need to take account of the PageSettings.printableArea as some printers cannot print to the edge of the page...
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
How does/Can one reduce the number of decimal places in a Double type?
|
|
|
|
|
I think this is what you want. It does not actually reduce the number of decimal places the variable is holding but allows for a reasonable number to be displayed. Create a windows form. add a textbox. use this as the load code.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim dbl As Double<br />
dbl = 10 / 3<br />
Me.TextBox1.Text = Format(dbl, "##.##")<br />
End Sub
|
|
|
|