- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要一个包含美元符号的文本框。我不希望允许用户在文本框中不使用它。
这是我的代码,它做得很好。现在我只需要以某种方式在开头硬编码 $。
Private Sub txtPriceAmount_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtPriceAmount.KeyDown
If (e.KeyCode >= Keys.D0 And e.KeyCode <= Keys.D9) OrElse (e.KeyCode >= Keys.NumPad0 And e.KeyCode <= Keys.NumPad9) OrElse e.KeyCode = Keys.Back Then
acceptableKey = True
Else
acceptableKey = False
End If
End Sub
Private Sub txtPriceAmount_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtPriceAmount.KeyPress
' Check for the flag being set in the KeyDown event.
If acceptableKey = False Then
' Stop the character from being entered into the control since it is non-numerical.
e.Handled = True
Return
Else
'must be in first position
If e.KeyChar = Convert.ToChar(Keys.Back) Then
If strCurrency.Length > 0 Then
strCurrency = strCurrency.Substring(0, strCurrency.Length - 1)
End If
Else
strCurrency = strCurrency & e.KeyChar
End If
If strCurrency.Length = 0 Then
txtPriceAmount.Text = ""
ElseIf strCurrency.Length = 1 Then
txtPriceAmount.Text = "0.0" & strCurrency
ElseIf strCurrency.Length = 2 Then
txtPriceAmount.Text = "0." & strCurrency
ElseIf strCurrency.Length > 2 Then
txtPriceAmount.Text = strCurrency.Substring(0, strCurrency.Length - 2) & "." & strCurrency.Substring(strCurrency.Length - 2)
End If
txtPriceAmount.Select(txtPriceAmount.Text.Length, 0)
End If
e.Handled = True
End Sub
完整代码。
公共(public)类 frmMidtermProject
Dim strCurrency As String = ""
Dim acceptableKey As Boolean = False
'Module level declarations
Structure Product
Dim ProductIDString As String
Dim DescriptionString As String
Dim QuantityInteger As Integer
Dim PriceDecimal As Decimal
End Structure
Private NumberProductsInteger As Integer = 37
Private InventoryProduct(NumberProductsInteger) As Product
Private TotalDueDecimal As Decimal 'total due for a customer
'Array to store the total sales for each product
Private ProductSalesTotalDecimal(NumberProductsInteger) As Decimal
Private Sub Load_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.lblTimeDate.Text = CStr(Date.Now)
'Initialize values - InventoryProduct array
InventoryProduct(0).ProductIDString = "102-1091"
InventoryProduct(0).DescriptionString = "2x4-92 & Chr(96) 5/8 SPF STUD"
InventoryProduct(1).ProductIDString = "102-1127"
InventoryProduct(1).DescriptionString = "2x4-12' #2 &BTR SPF CONSTR LUMB"
InventoryProduct(2).ProductIDString = "102-1130"
InventoryProduct(2).DescriptionString = "2x4-14' #2&BTR SPF CONSTR LUMB"
InventoryProduct(3).ProductIDString = "102-1143"
InventoryProduct(3).DescriptionString = "2x4-16' 5/8 #2&BTR SPF CONSTR LUMB"
InventoryProduct(4).ProductIDString = "102-1305"
InventoryProduct(4).DescriptionString = "2x4-104 5/8 SPF STUD"
InventoryProduct(5).ProductIDString = "102-1758"
InventoryProduct(5).DescriptionString = "2x6-8' STD/#2&BTR SPF CONSTR LUMB"
InventoryProduct(6).ProductIDString = "102-1774"
InventoryProduct(6).DescriptionString = "2x6-12' #2&BTR SPF CONSTR LUMB"
InventoryProduct(7).ProductIDString = "102-1923"
InventoryProduct(7).DescriptionString = "2x8-16' #2&BTR SPF CONSTR LUMB"
InventoryProduct(8).ProductIDString = "102-2184"
InventoryProduct(8).DescriptionString = "2x12-16' #2&BTR SPF CONSTR LUMB"
InventoryProduct(9).ProductIDString = "106-1501"
InventoryProduct(9).DescriptionString = "1-3/4x11-7/8 10' LVL"
InventoryProduct(10).ProductIDString = "106-2089"
InventoryProduct(10).DescriptionString = "1-3/4x11-7/8 10' LVL"
InventoryProduct(11).ProductIDString = "106-2115"
InventoryProduct(11).DescriptionString = "1-3/4x14 14' LVL"
InventoryProduct(12).ProductIDString = "106-2144"
InventoryProduct(12).DescriptionString = "1-3/4x14 18' LVL"
InventoryProduct(13).ProductIDString = "106-2209"
InventoryProduct(13).DescriptionString = "1-3/4x14 26' 20' LVL"
InventoryProduct(14).ProductIDString = "106-6742"
InventoryProduct(14).DescriptionString = "2-1/2X14-18' I Joist NI-60/PRi-60"
InventoryProduct(15).ProductIDString = "106-6768"
InventoryProduct(15).DescriptionString = "2-1/2X14-18' I Joist NI-60/PRi-60"
InventoryProduct(16).ProductIDString = "106-6807"
InventoryProduct(16).DescriptionString = "2-1/2X14-24' I Joist NI-60/PRi-60"
InventoryProduct(17).ProductIDString = "106-8106"
InventoryProduct(17).DescriptionString = "2-1/2X14-12' I Joist RIM BOARD"
InventoryProduct(18).ProductIDString = "111-0834"
InventoryProduct(18).DescriptionString = "2x4-12' AC2 TREATED AG LIFETIME WTY"
InventoryProduct(19).ProductIDString = "111-0847"
InventoryProduct(19).DescriptionString = "2x4-14' AC2 TREATED AG LIFETIME WTY"
InventoryProduct(20).ProductIDString = "124-2728"
InventoryProduct(20).DescriptionString = "7/16 (14/32)-4 XB OSB 3-WHITE STRIPES"
InventoryProduct(21).ProductIDString = "124-2809"
InventoryProduct(21).DescriptionString = "1/2 (16/32)-4 XB OSB 2-WHITE BLAK STRIPES"
InventoryProduct(22).ProductIDString = "124-2867"
InventoryProduct(22).DescriptionString = "3/4 (23/32)-4 XB OSB T&G 5-WHITE STRIPES"
InventoryProduct(23).ProductIDString = "131-1248"
InventoryProduct(23).DescriptionString = "1/2x4'-12' GYPsum 78LBL"
InventoryProduct(24).ProductIDString = "131-1256"
InventoryProduct(24).DescriptionString = "1/2x4'-8' MOLD/MR 78LBL"
InventoryProduct(25).ProductIDString = "131-1259"
InventoryProduct(25).DescriptionString = "5/8x4'-8' MOLD/MR TYPR X 105LBL"
InventoryProduct(26).ProductIDString = "131-1303"
InventoryProduct(26).DescriptionString = "5/8X4-12' GYPS PC TYPE X 105LBL"
InventoryProduct(27).ProductIDString = "131-2454"
InventoryProduct(27).DescriptionString = "8' METAL 1-1/4 CORNERBEAD"
InventoryProduct(28).ProductIDString = "131-2726"
InventoryProduct(28).DescriptionString = "ALL PURPOSE PALE-BLACK 7GAL"
InventoryProduct(29).ProductIDString = "131-2849"
InventoryProduct(29).DescriptionString = "EZ SAND 90 18#"
InventoryProduct(30).ProductIDString = "131-2881"
InventoryProduct(30).DescriptionString = "SPRAY-TEXTURE MEDIUM 40#"
InventoryProduct(31).ProductIDString = "131-3097"
InventoryProduct(31).DescriptionString = "PROROC JOINT TAPE 250'"
InventoryProduct(32).ProductIDString = "165-0372"
InventoryProduct(32).DescriptionString = "M/H208 ANJ COLUMN 3INCH DIAM -8'4"
InventoryProduct(33).ProductIDString = "227-1442"
InventoryProduct(33).DescriptionString = "NAIL 1-1/2 JOIST HANGER 5LB GALV"
InventoryProduct(34).ProductIDString = "228-3142"
InventoryProduct(34).DescriptionString = "JOIST HNGR TM 2.5X14 THO54140"
InventoryProduct(35).ProductIDString = "229-1202"
InventoryProduct(35).DescriptionString = "NAIL 8D V.C. SINKERS 50LBL BOX"
InventoryProduct(36).ProductIDString = "229-1244"
InventoryProduct(36).DescriptionString = "NAIL 16D V.C. SINKERS 50LBL BOX"
InventoryProduct(37).ProductIDString = "229-1303"
InventoryProduct(37).DescriptionString = "NAIL 16D GALVANZED BOX 50LBL BOX"
End Sub
Private Sub SearchBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchProducts.Click
'Search the ProductIDString property of the inventoryProduct
'array to see if the value of ProductIDTextBox matches an ID
'in the array
'Start variables to control the search
Dim FoundBoolean As Boolean = False 'Control how long to search
Dim RowInteger As Integer = 0 'Current row in the search
'Loop to do the search
Do Until FoundBoolean = True Or RowInteger > NumberProductsInteger
'Compare textBox to array
If txtProductID.Text = InventoryProduct(RowInteger).ProductIDString Then
'found a match - display other data to the readonly textboxes
cboProductIDLookup.SelectedItem = txtProductID.Text
txtDescription.Text = InventoryProduct(RowInteger).DescriptionString
txtQuantityAmount.Text = InventoryProduct(RowInteger).QuantityInteger.ToString
txtPriceAmount.Text = InventoryProduct(RowInteger).PriceDecimal.ToString("C2")
'change variable to indicate we have a match
FoundBoolean = True
Else
'no match yet
RowInteger += 1
End If
Loop
'After the search determine if the ProductID was found
If FoundBoolean = False Then 'no match was found
'Clear the textbox controls that display product information
'except for the ProductID textbox
txtDescription.Clear()
txtQuantityAmount.Clear()
txtPriceAmount.Clear()
cboProductIDLookup.SelectedIndex = -1
'Display message that the ProductID is not valid
MessageBox.Show("Reenter a valid product ID.", "Invalid Identifier", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtProductID.Focus()
txtProductID.SelectAll()
End If
End Sub
Private Sub PurchaseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PurchaseToolStripMenuItem.Click
'Test to determine if a product was found.
If txtDescription.Text = String.Empty Then
'Cannot purchase, product was not found
MessageBox.Show("You must select a valid product before purchasing.", "Cannot Purchase", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtProductID.Focus()
txtProductID.SelectAll()
Else
'Can purchase the product
'Build a string to display in the listbox control
Dim ProductString As String = txtProductID.Text.PadRight(12, " ") & "" & txtDescription.Text.PadRight(50, " ") & "" & txtQuantityAmount.Text.PadRight(7, " ") & "" & txtPriceAmount.Text.PadLeft(9, " ")
lstPurchaseItems.Items.Add(ProductString)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Accumulate the total value of this customer order
'and display it to the output textbox
TotalDueDecimal += (txtPriceAmount.Text * txtQuantityAmount.Text)
txtTotalDueAmount.Text = TotalDueDecimal.ToString("C2")
'TotalDueTextBox.Text = QuantityTextBox.Text * TotalDueDecimal.ToString("C2")
'Accumulate total sales by product to an array
Dim IndexInteger As Integer = cboProductIDLookup.SelectedIndex
ProductSalesTotalDecimal(IndexInteger) += (txtPriceAmount.Text * txtQuantityAmount.Text)
'Here you can clear the form of product info if you think
'that is a good way to do the processing
cboProductIDLookup.SelectedIndex = -1
txtProductID.Clear()
txtDescription.Clear()
txtPriceAmount.Clear()
txtQuantityAmount.Clear()
txtProductID.Focus()
End If
End Sub
Private Sub ResetToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ResetToolStripMenuItem.Click
'Clear all text box and combobox controls
cboProductIDLookup.SelectedIndex = -1
txtProductID.Clear()
txtDescription.Clear()
txtPriceAmount.Clear()
txtQuantityAmount.Clear()
txtTotalDueAmount.Clear()
'Clear the list box control
lstPurchaseItems.Items.Clear()
'Reset the total due module-level variable to zero
TotalDueDecimal = 0
'Set the focus to the product ID text box
txtProductID.Focus()
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
Dim MessageString As String = "John Burton Version 1" & ControlChars.NewLine & "Today's date/time: " & Date.Now
Dim TitleString As String = "About Version 1"
MessageBox.Show(MessageString, TitleString, MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
'Close the form
Me.Close()
End Sub
Private Sub ProductIDComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboProductIDLookup.SelectedIndexChanged
'Test to determine if a product has been selected
If cboProductIDLookup.SelectedIndex <> -1 Then
'Store the selectedIndex to variable
Dim RowInteger As Integer = cboProductIDLookup.SelectedIndex
'Based on RowInteger, display values to TextBox controls
'from the array named inventoryProduct
txtProductID.Text = InventoryProduct(RowInteger).ProductIDString
txtDescription.Text = InventoryProduct(RowInteger).DescriptionString
txtQuantityAmount.Text = InventoryProduct(RowInteger).QuantityInteger.ToString("N0")
txtPriceAmount.Text = InventoryProduct(RowInteger).PriceDecimal.ToString("C2")
End If
If Not IsNumeric(txtQuantityAmount.Text) Then
MsgBox("Numeric input only!", vbCritical, "Invalid Input")
txtQuantityAmount.Text = ""
End If
End Sub
Private Sub TotalSalesByProductToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TotalSalesByProductToolStripMenuItem.Click
'Display output to immediate window
Dim RowInteger As Integer
Dim SalesString As String = "ProductID" & vbTab & vbTab & "Amount" & vbCrLf
For Each ProductItem As Product In InventoryProduct
'Build string to display
SalesString &= ProductItem.ProductIDString.PadLeft(8, " ") & vbTab & vbTab & ProductSalesTotalDecimal(RowInteger).ToString("C2").PadLeft(12, " ") & vbCrLf
'Increment RowInteger
RowInteger += 1
Next
SalesString &= "" & vbCrLf
SalesString &= "Total Due" & vbTab & vbTab & txtTotalDueAmount.Text & vbCrLf
Dim Answer As String
Dim MyNote As String
MyNote = MessageBox.Show(SalesString, "Sales Totals, Do you want to save this File", MessageBoxButtons.OK, MessageBoxIcon.Information)
MyNote = "Do you want to save the Sales Totals Summary to File?"
Answer = MsgBox(MyNote, vbYesNo, "Sales Totals to File")
If Answer = vbNo Then
'Code for No Responce
End If
If Answer = vbYes Then
'Code for Yes Responce
sFile.InitialDirectory = ("C:\")
sFile.FileName = ("Save As...")
sFile.Filter = ("Only Text Files (*.txt)|*.txt")
sFile.ShowDialog()
Dim W As New IO.StreamWriter(sFile.FileName, True) ' notes from class need messgbox
W.WriteLine(lblTimeDate.Text & vbCrLf & vbCrLf & txtJobFileName.Text)
W.WriteLine()
W.WriteLine()
W.WriteLine(SalesString)
W.Close()
End If
End Sub
Private Sub SearchToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchToolStripMenuItem.Click
'Call the Click event for theSearch button control
btnSearchProducts.PerformClick()
End Sub
Private Sub SaveAsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SaveAsToolStripMenuItem.Click
sFile.InitialDirectory = ("C:\")
sFile.FileName = ("Save As...")
sFile.Filter = ("Only Text Files (*.txt)|*.txt")
sFile.ShowDialog()
Dim W As New IO.StreamWriter(sFile.FileName, True) ' notes from class need messgbox
W.WriteLine(lblTimeDate.Text & " " & txtJobFileName.Text)
W.WriteLine()
W.WriteLine()
Dim ProductString As String = lblSkuNumper.Text.PadRight(12, " ") & "" & lblDescription.Text.PadLeft(27, " ") & "" & lblQuantityAmount.Text.PadLeft(28, " ") & "" & lblPriceAmount.Text.PadLeft(11, " ")
W.WriteLine(ProductString)
W.WriteLine()
Dim i As Integer
For i = 0 To lstPurchaseItems.Items.Count - 1
W.WriteLine(lstPurchaseItems.Items.Item(i))
Next
W.WriteLine()
W.WriteLine()
Dim TotalDue As String = txtTotalDueAmount.Text.PadLeft(70, ".")
W.WriteLine(vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "TotalDue" & txtTotalDueAmount.Text.PadLeft(22, ""))
W.Close()
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExitDesign.Click
Me.Close()
End Sub
Private Sub btnResetClearItems_Click(sender As Object, e As EventArgs) Handles btnResetClearItems.Click
ResetToolStripMenuItem.PerformClick()
End Sub
Private Sub txtQuantityAmount_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtQuantityAmount.KeyPress
If (e.KeyChar < "0" OrElse e.KeyChar > "9") AndAlso
e.KeyChar <> ControlChars.Back Then
e.Handled = True
End If
' use this to add any special characters..............e.KeyChar <> "." AndAlso
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnSearchDescription.Click
'Search the ProductIDString property of the inventoryProduct
'array to see if the value of ProductIDTextBox matches an ID
'in the array
'Start variables to control the search
Dim FoundBoolean As Boolean = False 'Control how long to search
Dim RowInteger As Integer = 0 'Current row in the search
'Loop to do the search
Do Until FoundBoolean = True Or RowInteger > NumberProductsInteger
'Compare textBox to array
If txtDescription.Text = InventoryProduct(RowInteger).DescriptionString Then 'If txtProductID.Text = InventoryProduct(RowInteger).ProductIDString Then
'found a match - display other data to the readonly textboxes
txtProductID.Text = InventoryProduct(RowInteger).ProductIDString
cboProductIDLookup.SelectedItem = txtProductID.Text
txtDescription.Text = InventoryProduct(RowInteger).DescriptionString
txtQuantityAmount.Text = InventoryProduct(RowInteger).QuantityInteger.ToString
txtPriceAmount.Text = InventoryProduct(RowInteger).PriceDecimal.ToString("C2")
'change variable to indicate we have a match
FoundBoolean = True
Else
'no match yet
RowInteger += 1
End If
Loop
'After the search determine if the ProductID was found
If FoundBoolean = False Then 'no match was found
'Clear the textbox controls that display product information
'except for the ProductID textbox
txtDescription.Clear()
txtQuantityAmount.Clear()
txtPriceAmount.Clear()
cboProductIDLookup.SelectedIndex = -1
'Display message that the ProductID is not valid
MessageBox.Show("Reenter a valid product ID.", "Invalid Identifier", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
txtProductID.Focus()
txtProductID.SelectAll()
End If
End Sub
Private Sub txtPriceAmount_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtPriceAmount.KeyDown
If (e.KeyCode >= Keys.D0 And e.KeyCode <= Keys.D9) OrElse (e.KeyCode >= Keys.NumPad0 And e.KeyCode <= Keys.NumPad9) OrElse e.KeyCode = Keys.Back Then
acceptableKey = True
Else
acceptableKey = False
End If
End Sub
Private Sub txtPriceAmount_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtPriceAmount.KeyPress
' Check for the flag being set in the KeyDown event.
If acceptableKey = False Then
' Stop the character from being entered into the control since it is non-numerical.
e.Handled = True
Return
Else
'must be in first position
If e.KeyChar = Convert.ToChar(Keys.Back) Then
If strCurrency.Length > 0 Then
strCurrency = strCurrency.Substring(0, strCurrency.Length - 1)
End If
Else
strCurrency = strCurrency & e.KeyChar
End If
If strCurrency.Length = 0 Then
txtPriceAmount.Text = ""
ElseIf strCurrency.Length = 1 Then
txtPriceAmount.Text = "0.0" & strCurrency
ElseIf strCurrency.Length = 2 Then
txtPriceAmount.Text = "0." & strCurrency
ElseIf strCurrency.Length > 2 Then
txtPriceAmount.Text = strCurrency.Substring(0, strCurrency.Length - 2) & "." & strCurrency.Substring(strCurrency.Length - 2)
End If
txtPriceAmount.Select(txtPriceAmount.Text.Length, 0)
End If
e.Handled = True
End Sub
Private Sub btnPurchaseItems_Click(sender As Object, e As EventArgs) Handles btnPurchaseItems.Click
PurchaseToolStripMenuItem.PerformClick()
End Sub
下课
最佳答案
有几种方法可以解决您的问题,但首先您需要添加一个 MaskedTextBox控制您的表单。
完成后,您可以将控件的“掩码”属性(在 F4 属性中)设置为您希望的任何值,如“$00.00”。或者,您可以通过执行以下操作将其与按钮点击等事件相关联:
private void someButton_Click(object sender, EventArgs e)
{
maskedTextBox1.Mask = "$00.00";
}
无论哪种情况,这都应该为您提供您希望的结果。
关于vb.net - 格式化文本框以始终显示 $ 符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19325018/
我正在为一个网站开发应用程序(我无法访问该网站)。 所以我想做以下事情: 那么如何将文本数据从 Android View 传递到网页中的文本框并捕获来自网站的响应? 我试图记住这一切我无法访问任何网站
我有一个文本框,里面有一个很长的 url。我想做的是,当用户点击主页按钮时,我希望光标移动到文本框的开头。 我希望这是正常行为,但事实并非如此,当文本框内的文本很长时,我点击回家,它会转到文本框中当前
我正在做一个WPF登录界面。在我的登录面板中,我有一个登录 TextBox和 PasswordBox .如下图第一张所示,登录文本框中有一个小人类标志,密码框中有一个锁。我将图像设置为文本框背景,然后
是否有任何简单的方法可以使文本在文本框中居中?我正在寻找一些内置函数,但什么也没找到。 最佳答案 将 TextAlignment 属性设置为 Center: 关于wpf - 文本框 - 水平文本居中
是否可以使用 System.Windows.Forms.TextBox(或任何其他方法)输入可随后转换为安全字符串的文本?我希望能够获取输入的值,将其转换为安全字符串并将其写入一个文件,然后可以在需要
是否可以使用 System.Windows.Forms.TextBox(或任何其他方法)输入可随后转换为安全字符串的文本?我希望能够获取输入的值,将其转换为安全字符串并将其写入一个文件,然后可以在需要
我想将纬度和经度的值返回到我的 EditText 中,我已经能够使用 Toast 来做到这一点,但没有通过 实现它>编辑文本。请帮忙 // EditText latEditText =
我是Jquery新手,其实我对JQuery的使用知识是0。我正在尝试使用 JQuery 来实现某些功能。 我有一个带有 iframe 的 html 页面。 iframe 页面中有一个表单和一个文本框。
我正在尝试在 Button 的事件处理程序中访问我在 C# 中动态创建的 TextBox。 void MainFormLoad(object sender, EventArgs e)
我有一个搜索栏,当我打开搜索栏时,我想立即开始输入,不想点击文本框。 我尝试使用 myTextBoxId.click()(因为当您单击它时,您可以开始输入)但它不起作用。 最佳答案 你必须 docum
我还没有找到好的解决方案:我有一个文本框,用户需要能够在其中输入特定 信息。例如,命令可能是“9030 OUT FU [1234 TEST]”。我需要“擦洗”这个文本框以确保数据是以这种格式输入的(不
我有一个 Java 应用程序,您可以在其中将字符串输入文本框,点击加密,它会在单独的文本框中显示加密的字符串。我将为此使用 AES 加密。问题是我无法让加密文本按字节显示,但文本框不会显示字节(仅采用
我已经浏览了您庞大的问题数据库,但似乎没有找到答案。我在将文本换行时遇到问题 - 即使之前的行上仍有空间。这是代码: p1 { border-left: 6px solid blue; bac
所以我正在尝试创建“看板/待办事项列表”网站,但我在触发添加按钮时遇到了问题。我试图触发“添加”按钮以打开用户输入框。所以我有这个创建一个小框的“添加”按钮。但我无法弄清楚如何在该框中添加一个小区域,
我有一个文本框,应该只接受浮点值。它不应该允许任何其他值。怎么做。我在 HTML 中完成了此操作。 Weight 但是,它不起作用?如何做到这一点。 最佳答案 // remo
当用户点击文本框时,如何不显示出现在文本框下方的已填充值 最佳答案 将这个属性放在你的文本框中 autocomplete="off" 关于javascript - 文本框 - 如何不显示已填充的值,我
JavaScript: function resize(elem){ if(!elem.value.length) elem.size=1; else elem.size=elem.value
在我的代码下面,我需要它具有相同的宽度和高度,但有多行“从第一行开始”,当到达行尾时转到新行,只有 120 个字符,就像我用“Enter短信”当您向右单击时隐藏,但我需要它为灰色。 最佳答案 您可以使
我有一个问题,我必须创建一种方法来搜索显示在多个文本框 (lblResult.Text) 中的选定文本文件的内容。使用简单的搜索算法:搜索用户输入的整个搜索词。例如,如果用户输入“hello”,则只搜
我正在尝试对文本框使用 SelectionStart 和 SelectionLength 属性。它没有效果,但也没有错误。它实际上是后台工作程序 ProgressChanged 方法的一部分,但我已经
我是一名优秀的程序员,十分优秀!