| Capture Keys in Textbox, VB.net 2005: |
|
 |
Index ‹ Visual Basic ‹ Visual Basic General
|
- Previous
- 1
- Visual Basic Language Calculations
This is totally differetent from Access
I have got a field's property set to money
I need to divide that field by 2(sounds simple)
but VB is haven a fit.
I am used to
me.text1= me.text2 / 2
its saying that / is not defined
how do you divide and multiply in VBE
Davids Learning
- 2
- Visual Basic Language Error in defintion of Array??
HI,
I am facing a problem with array of array.
I have web service of the following code :
Public Structure Client Public id As Integer Public name As String Public Serv() As Services End Structure Public Structure Services Public ID As Integer Public Name As String Public Details As String End Structure
Trying to send infoprmation using the following code:
Dim webserv As New localhost.Service1 Dim tClient As localhost.Client() = New localhost.Client(1) {}
tClient(0) = New localhost.Client tClient(0).id = i tClient(0).name = i * 2
tClient(0).Serv(0).ID = 100 <------------ (Getting error message here)
The error message is:
"Object reference not set to an instance of an object"
What is the problem Is there any way that solve my problem
Please help
- 3
- Visual Basic General How can I Find values in a DataTable?
Hello folks,
in VB .NET: I have made a table with 2 columns - 1. is the primary key, 2. contains whatever info. When i use the myTable.rows.find(primarykey)-method VB finds the row with the specified primary key value, and then I can extract the value in the 2. column. But, how can I do the opposite, i.e. make VB find a specified value in the second column such that I can extract the primary key(s)
I guess there is an easy way to do this, but I've not been able to find it :-(
Hope anyone can help...
- 4
- Visual Basic General Error whilst using Visual Basic 6 to read from an Access 97 database.
Hy, I am new to VB6 and am hoping that someone may be able to help me with the following problem i am experiencing.
I have a form where a user can log in using their number (RUNUS.text) and password (RUPasswd.text). The form is linked to an Access 97 database which holds a number of columns including those called nus and password. The program should check that the user exists on the database before allowing entry to any further forms. In summary then i am just trying to read from the db.
The problem is when running the application i am receiving an error message stating: "Compile Error: Argument not optional", and the word ".FindFirst" is highlighted as the problem.
Can anyone advise where i am going wrong with this Any help would be much appreciated. The relevant code is listed below:
Private Sub EnterButton2_Click()
If (Frame3.Visible = False) And (RUNUS.Text <> "") And (RUPasswd.Text <> "") Then
Dim db As Database Dim rs As Recordset Dim strCriteria As String Set db = OpenDatabase("C:\logindb.mdb") Set rs = db.OpenRecordset("user", dbOpenSnapshot)
strCriteria = "nus = '" & RUNUS.Text & "' And password = '" & RUPasswd.Text & "'"
rs.FindFirst.strCriteria If rs.NoMatch Then ErrorMsg.Caption = EM4 error_count = error_count + 1 Else EnterButton1.Visible = False EnterButton2.Visible = False Project1.Form5.Hide Project1.Form6.Show End If db.Close End If
End Sub
- 5
- 6
- Visual Basic General pass xml file to web service from a Windows service
I have been trying for the past couple of hours to figure out how to send an xml file as a parameter to a web service, but everything I try results in the xml file being escaped when it is stored in the database. My web service is expecting a sqlxml datatype which works fine if I am not using a Windows service to consume the web service. The Windows service tells me:
The type System.Data.SqlTypes.SqlXml may not be used in this context. To use System.Data.SqlTypes.SqlXml as a parameter, return type, or member of a class or struct, the parameter, return type, or member must be declared as type System.Data.SqlTypes.SqlXml (it cannot be object).
Intelisense lists the parameter that is expecting SqlXml as an Object.
Dim test As New XmlTextReader("C:\Inetpub\wwwroot\WebService\Results1.xml")
Dim SqlXmlValue As SqlXml = New SqlXml(test)
Please help.
- 7
- Visual Basic General Change color on valueHere's what I have but it does not work, what am I doing wrong
Select Case ProgressBar1.Value Case Is < 40 ProgressBar1.ForeColor = Color.Red Case Is < 60 ProgressBar1.ForeColor = Color.Aqua Case Is <= 94 ProgressBar1.ForeColor = Color.Blue Case 95 To 100 ProgressBar1.ForeColor = Color.Green End Select
- 8
- Visual Basic Language Type conversion problem
I'm using the .NET framework v1.1 and dominantly C#, but am having a problem with some VB code.
First of all, I have a type:
public class Field { object _fieldValue;
private object FieldValue { get { return _fieldValue; } set { _fieldValue = value; } }
public static implicit operator Field(string fromRawString) { Field untypedField = new Field(); untypedField.FieldValue = fromRawString; return untypedField; } }
(Compiled using "csc /target:library MyType.cs")
I then write a program to use this type:
public class Klass { public static void Main() { string s = "Hello World"; Field f = s; } }
(Compiled using "csc /r:MyType.dll MyProg.cs")
I then write a similar program to use this type, but this time in VB.NET
Module Klass Sub Main() Dim s as String = "Hello World" Dim f as Field = s End Sub End Module
(Compiled using "vbc /r:MyType.dll MyProg.vb")
But the vb compiler emits an error message that the C# one doesn't: error BC30311: Value of type 'String' cannot be converted to 'Field'.
Now here's the thing... If I use the vbc from .NET 2.0, it works, so it appears to be a bug that has been fixed.
I'm interested in a work-around though. I would like to release an assembly built on the 1.1 Framework that contains a type that allows for implicit type conversion. I would like customers who use VB.NET to be able to do said type conversion. Is there a way for me to get this working
Thanks, --Nick
- 9
- Visual Basic Language Define Class?
I dont know if thats the right thing to say or not being I'm still green, but
If I had a calculation that I needed to do often, is there a way t o make that (Public(Dont know if thats right or not))
I am wanting not to have to type the calculation over and over
just wanting to put it in one place and refer to it if possible.
Then how would you call it
Davids Learning
- 10
- Visual Basic General Package and Deployment Wizard - Error number 457 I am starting to package a VB application. The error occurs while the wizard is "searching for additional dependencies".
The error is "Unexpected error number 457 has occurred: The key is already associated with an element of this collection."
Need help trying to get past it.
Please advise.
Thanks.
- 11
- Visual Basic Language Bug found in String.LastIndexOf
Hello!
I think, I found a bug in the LastIndexOf-method.
In my application I'm using the IndexOf- and LastIndexOf-methods for finding text up and down in a RichTextBox.
IndexOf works 100% correct, but if I use LastIndexOf with a StartIndex supplied, it returns -1. Using LastIndexOf without the StartIndex parameter, the correct index is returned. The String in the TextBox is about 2,000 chars.
StartIndex indicates the current char position index in the rtb.
Here's the code:
With rtb
If FindDirection = EFindDirection.Forward Then
If StartIndex < .Text.Length Then
Idx = .Text.IndexOf(StrFind, StartIndex, _
System.StringComparison.CurrentCultureIgnoreCase)
End If
Else '# Direction: Back (to the top)
If StartIndex - StrFind.Length > -1 AndAlso StartIndex < .Text.Length Then
'# Works correct:
Idx = .Text.Substring(0, StartIndex - StrFind.Length).LastIndexOf(StrFind, _
System.StringComparison.CurrentCultureIgnoreCase)
'# Returns -1:
Idx = .Text.Substring(0, StartIndex - StrFind.Length).LastIndexOf(StrFind, 0, _
System.StringComparison.CurrentCultureIgnoreCase)
End If
End If
If Idx > -1 Then
.SelectionStart = Idx
.SelectionLength = StrFind.Length
End If
End With
Did anyone notice the same bug The Bug also occures in the immediate-window. Is a hotfix already available
I'm using the following environment:
Microsoft Visual Studio 2005 Version 8.0.50727.42 (RTM.050727-4200) Microsoft .NET Framework Version 2.0.50727
Installed Edition: Professional
Microsoft Visual Basic 2005 77626-009-0000007-41273 Microsoft Visual Basic 2005
Microsoft Visual C# 2005 77626-009-0000007-41273 Microsoft Visual C# 2005
Microsoft Visual C++ 2005 77626-009-0000007-41273 Microsoft Visual C++ 2005
Microsoft Visual J# 2005 77626-009-0000007-41273 Microsoft Visual J# 2005
Microsoft Visual Studio 2005 Tools for Applications 77626-009-0000007-41273 Microsoft Visual Studio 2005 Tools for Applications
Microsoft Visual Web Developer 2005 77626-009-0000007-41273 Microsoft Visual Web Developer 2005
Hotfix for Microsoft Visual Studio 2005 Professional Edition - ENU (KB917452) This Hotfix is for Microsoft Visual Studio 2005 Professional Edition - ENU. \n
Thanks
Cordt
- 12
- Visual Basic General AppendText
I used AppendText for merging any files.
But i have a problem.
The path of the files from merging with AppendText are in the ListBox.
But when I merge files as text my software put ListBox1.Items.Text and the item are only the path of the file from merging.
Ex.
If in ListBox I have 2 items
- C://output1.txt
- C://output2.txt
The text of the file that my software created wit AppendText will be
- 13
- Visual Basic IDE vb.net assemblies with VS 2005Hello All,
OK, here's the situation:
I am in the process of building a shopping cart web application in
.NET, using two separate platforms. Our development environment
uses .NET Framework 2.0 and Internet Information Server 5.1 under
Windows XP Professional with SP2, while our target (production) server
is .NET Framework 2.0 and IIS 6.0, under Windows 2003 with SP1.
The code consists of a couple of compiled vb.net classes and some
asp.net files, all of which were built as projects in Visual Studio
2005 on the development platform. All of the class projects were
setup with strong names through VS 2005, along with the required .snk
keys. So far so good.
I'm able to add the built assemblies to the Global Assembly Cache on
the development platform without any problems, as this cart is to be
used with several individual websites. I added the assemblies
through the .NET Configuration Manager provided with Adminstrative
Tools. Again, so far so good.
The problem starts when moving everything over to the production
server. From what I understand, I should be able to copy over the
assemblies and register them directly with the Global Assembly Cache on
the production server in the same manner. When I try to add my
assemblies to the GAC, however, I get an error message saying that they
could not be added and that "The assembly must have a strong name
(name, version and public key)." This message persists even after
I have moved the .snk key files over to the production server as well.
Any idea why the production server doesn't see the assemblies as
strongly named, while the development server works with no
problem Am I just not deploying the files properly, or is this
an issue with the Visual Studio 2005 IDE Any help would be
greatly appreciated.
Many Thanks,
Parmjit,
Developer
- 14
- 15
- Visual Basic General Alternative to Data Reader (VB.NET 2003)In my following code I want to use any Array variable that can store the result. I don't want to use the Data Reader as given below. Is
there any alternative.
----------------------------------------------------CODE--------------------------------------------------------------- Private Sub cmdModify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdModify.Click Dim strFind, strModify As String Dim FindDr As OleDb.OleDbDataReader Dim cmdFind As New OleDb.OleDbCommand(strFind, cn2)
myRecID = Val(InputBox("Enter Item ID:", "Modify Item Entries"))
strFind = "Select * from Firms_Master Where FirmID=" & myRecID
FindDr = cmdFind.ExecuteReader(CommandBehavior.CloseConnection)
While FindDr.Read If FindDr(0) = myRecID Then strModify = FindDr(1) txtFirmAddress.Text = FindDr(2) txtFirmPhoneno.Text = FindDr(3) txtFirmCity.Text = FindDr(4) fyear1.Text = FindDr(5) fyear2.Text = FindDr(6)
FindDr.Close() cmdFind.Dispose() txtFirmName.Text = strModify txtFirmName.Focus() Exit Sub Else MsgBox("Not Found") End If End While
FindDr.Close() cmdFind.Dispose() End Sub ----------------------------------------------------------------------------------------
.............. RPK
|
| Author |
Message |
mfroster

|
Posted: Visual Basic General, Capture Keys in Textbox, VB.net 2005: |
Top |
I'm working on learning VB.Net, using 2005,
In VB 6, when you use a textbox:
Private Sub txtPv_KeyPress(Index As Integer, KeyAscii As Integer) 'If the ENTER is pressed, then call the function to set the PV. If KeyAscii = 13 Then Call cmdSetPv_Click(Index) End If
End Sub
However, with VB.Net, when I select the "KeyPress" I get:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
End Sub
I can't figure out how to capture the keys that were pressed using the arguments to the TextBox1_KeyPress Sub.
All of the help that I can find tells me that the "KeyPress" is as:
Private Sub Text1_KeyPress(KeyAscii As Integer)
What am I missing
Mfroster
Visual Basic14
|
| |
|
| |
 |
McWhirter

|
Posted: Visual Basic General, Capture Keys in Textbox, VB.net 2005: |
Top |
I think its pretty similar to you vb6 process, although i use Keydown, intead of Keypress (someone who knows could explain why you would use one instead of the other)
I think the keypress event uses e.keychar instead of e.keyvalue
Ie
Private Sub FrmMain_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyValue = Keys.Tab Then
...
Else
....
End If
End Sub
Or you could use a select case statement similar to
Select Case e.keyvalue
Case 9 ' 9 = Tab
...
Case 13 ' 13 = Enter
...
End Select
Hope That helps you somehow :)
|
| |
|
| |
 |
jacob tan

|
Posted: Visual Basic General, Capture Keys in Textbox, VB.net 2005: |
Top |
Hi,
Hope this help. I think you have missing out some format. Just grap this in and try :)
Private Sub txtbox_keypress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox6.KeyPress, TextBox7.KeyPress, TextBox8.KeyPress
If e.KeyChar = Chr(13) Then 'should add in Tab
'chr(8) is backspace
'chr(9) is TAB
'chr(13) is Return
End If
End Sub
|
| |
|
| |
 |
Jared Parsons MSFT

|
Posted: Visual Basic General, Capture Keys in Textbox, VB.net 2005: |
Top |
A way to make this code more readable is to use the Keys enumeration directly. You can call Microsoft.VisualBasic.ChrW() on Keys enumeration. For example
if e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Enter) Then
|
| |
|
| |
 |
mfroster

|
Posted: Visual Basic General, Capture Keys in Textbox, VB.net 2005: |
Top |
Thanks guys, it works.
I had tried the "e.keychar" but apparently not correctly.
I really appreciate all the hints. On to the next learning experience...
Mfroster
|
| |
|
| |
 |
weirdbeardmt

|
Posted: Visual Basic General, Capture Keys in Textbox, VB.net 2005: |
Top |
|
| |
 |
RDT

|
Posted: Visual Basic General, Capture Keys in Textbox, VB.net 2005: |
Top |
I have found that using a chr() works with e.keychar. for instance:
Private Sub frmGame_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles frmGame.KeyPress
If e.KeyChar = Chr(65) then 'Chr(65) = A
lblLetterDisplay.text = A
else
bah
end if
end sub
|
| |
|
| |
 |
NnethKe

|
Posted: Visual Basic General, Capture Keys in Textbox, VB.net 2005: |
Top |
|
I'm new in programming with vb.net 2005 and I hope u can help me with this
how can I use this samples so I can start loading a combobox, for instance: using a textbox - I press 'm' in my keyboard and load in a combobox all items that start with 'm'. |
|
| |
|
| |
 |
| |
 |
Index ‹ Visual Basic ‹ Visual Basic General |
- Next
- 1
- 2
- 3
- Visual Basic IDE Is datarow empty?
I have this code, which is used to extract a single datarow from a table. How can I determine whether the datarow is empty (that is, if the filter variable does not exist in the table )
tia
MyDataRow = DataSet1.Tables("MyTable").Select("MyFilter")
- 4
- Visual Basic Language How to add MaskedTextBox control to Toolbox?
Hi all !!
I am new to vb.net.... I want to use MaskedTextBoxControl in my form, But It has not been in the list of Toolbox, so that I can drag from there to my Windows form. So how can I add MaskedTExtBox control to Toolbox
I would really appreciate for the responses.
Thanks.
- 5
- Visual Basic General How to skip an item while datareader reads?Here is my code to retreive data from my database to display in a listview.
Me.lviewPatList.Items.Clear()
While MyDataReader.Read
Dim patOrders As ListViewItem = lviewPatList.Items.Add(MyDataReader(0).ToString) patOrders.UseItemStyleForSubItems = False
With patOrders .SubItems.Add(CDate(MyDataReader(1).ToString).ToShortDateString) .SubItems.Add(MyDataReader(3).ToString) .SubItems.Add(CDec(MyDataReader(12).ToString()).ToString("n2")) .SubItems.Add(CDec(MyDataReader(13).ToString()).ToString("n2")) .SubItems.Add(CDec(MyDataReader(30).ToString()).ToString("n2")) .SubItems(5).ForeColor = Color.Maroon
End With
End While Myconnection.Close()
Now, my question is, how can I possibly skip an item when MyDataReader(30).ToString ="0".Thanks....
- 6
- Visual Basic General Communicating high scores
So, i have finished a game I have been making, but i am interested in communicating the high scores between computers. Somebody suggested that i create a master computer, which will keep track of all the high scores, and they will all check with it to bring up a current list of high scores, is this easily doable While i am up for a challenge i am somewhat new to visual basic 2005 (learned in 6.0) and have a limited knowledge pertaining to inter-computer communication. Would i have to set up a server to do this
If so how would i do that, and is it simple for somebody who has never done it before
If a server is not required, how would this work I would appreciate any help.
- 7
- Visual Basic Language data storageAs posted in another thread, I'm planning to build an accounting program. I'm wondering what would be the best way to store the data, using databases or perhaps XML There will be over 50 administrations and several users. Would one database per administration be most efficient considering one administration will usually be accessed by one user at a time Using XML probably means smaller file sizes and therefore less network traffic, but databases offer more functionality. Anyone has experience with this
Any help would be welcome.
Regards, Eric
- 8
- Visual Basic Language Converting colors to brushes
I am making a program that repeatedly draws rectangles onto the screen using e.Graphics.FillRectangle in the Paint method of the form.
My problem is that I want to allow the user to change the color of the rectangles using a standard color dialog, but the color dialog gives a system.drawing.color object rather than a system.drawing.brushes object, which is required to set the color of the rectangles
I cant figure out how to convert between the two objects. Is there some other way I should be going about this
- 9
- Visual Basic IDE ??? :( Loading into & Saving Text File from RichTextBox ): ???
For the project of compiler, i already have the rows & cols sloutons from these forums, thanks every one for that specally dman1
now for the phase of Lexical Analysis, i have to generate tokens, i m using vb.net, i have made a listbox that holds all possible KEYWORDS alowed in the grammer, i match every seperate WORD with all itmes of that list
now the problem is all KEYWORDS found should be displayed & saved in a text file, i want to know how can we save the text in the richtextbox control in a text file, & how can we load it back
see simply loading text file into & Saving Text File from RichTextBox
Also if someone can tell if we want to check the character we are reading from the rich text box, we write
if rtb1.text.chars(index) = "A"
if rtb1.text.chars(index) = "@"
if rtb1.text.chars(index) = " " 'to check if thats space
then how can we check if that position character is a new line or return key character / symbol
Also tell please when we write
if rtb1.text.chars(index).isSeperator
what character are detected in IsSeperator, in isWhitreSpace (does the newline / return key symbol is detected in this), in isSurrogate (what is this )
- 10
- Visual Basic General Displaying specific data in datagridview on basis of run time query.
I have got a datagridview on my windows form in VB.NET 2005. The data grid's data source is WR130BindingSource. I have dragged a combo box from WCDESC_I in WC931 table.
My problem is I want the datagrid to display only that specific data (only five columns while the table contains 20 columns) from WR130 table when the user selects a WCDESC_I from WC931.
So what happens is when user selects WCDESC_I from combobox, I find the WCID_I of that row and from this WCID_I found from WC931, I need to find all the records in WR130 which contain the same WCID_I.
Further more, I have to also display the data where DONE_CB in WR130 table is not equal to 1.
Also, I have to filter the data to be displayed in the data grid on basis where WO32.ORDERSTATUS = 3 OR 7. Which means first |I have to find all the MoNumbers in WO32 whose OrderStatus is either 3 or 7. Then I have to find all those MoNumbers in WR130 and then display them.
WC931 and WR130 have WCID_I in common.
WO32 and WR130 have MoNumber in common.
So when the user selects, WCDESC_I from the combo box, I need this query to take effect and show the data in data grid:
SELECT dbo.WR010130.MANUFACTUREORDER_I, RTSEQNUM_I, RTSEQDES_I, SCHEDULESTARTDATE_I, DONECB_I
FROM dbo.WR010130 JOIN WO010032 ON dbo.WR010130.MANUFACTUREORDER_I = dbo.WO010032.MANUFACTUREORDER_I
JOIN dbo.WC010931 ON dbo.WR010130.WCID_I = dbo.WC010931.WCID_I
WHERE dbo.WR010130.DONECB_I <> 1 AND dbo.WO010032.MANUFACTUREORDERST_I = 3 OR dbo.WO010032.MANUFACTUREORDERST_I = 7 AND dbo.WC010931.WCDESC_I = WorkCentreComboBox.Text
ORDER BY dbo.WR010130.SCHEDULESTARTDATE_I
WC931.WCID_I is found from the WCDESC_I which user selects from combobox. All the three data tables namely WC931, WO32, WR130 are in my medataset.
So how can I do this at run time
- 11
- Visual Basic General Sql Server project stuff...
Dear folks,
I’ve created a Sql Server Project from my Visual Studio 2005 with Visual Basic.
When I try to add GetCommand it doesn’t appear at all, intelligense doesn’t show me that method. Why
I don’t get the point. What else/assembly is needed
Dim oCommand As New SqlCommand
Dim oPipe As New SqlPipe
oCommand = SqlContext.
Thanks in advance for your comments and thoughts,
- 12
- 13
- 14
- 15
|
|
|