|
When a user inputs data into the textbox
The textbox control provides a list of previous entered values
is there a way to disable this in vb.net web form .net 1.1
|
|
|
|
|
It's not the Textbox that's doing this. It's the users browser that's doing it, and no, you have no control over this from your ASP.NET code.
|
|
|
|
|
You will have to set the autocomplete property for your textbox. The intellisense of Visual studio 2003 doesn't provide you with the option.
<br />
<br />
<asp:TextBox id="txtControl" runat="server" autocomplete="off"></asp:TextBox>
You can do it at the form level by setting <form id="Form1" method="post" runat="server" autocomplete="off">
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
Hmmm...Shows you how much of an ASP.NET expert I am!
|
|
|
|
|
You can blame Microsoft , I have found many properties not showing up in the Intellisense or the properties window of the control . I guess we just need to learn from trial and error method and of course the experience.
For ex the intellisense of the DropDownList in visual studio 2005 doesn't show the SelectedValue property and I was trying to figure out a way to bind the DropDownList to the Gridview, just trying my luck, I typed in SelectedValue inside the tag and binded it to the gridview and it worked. I guess Microsoft needs to come out with a list of "Hey I have coded this but forgot to put it in the Intellisense list"
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
I want to select a row and get all data in every cell in all columns. I was able to get all cells by using VisibleColumnCount. But that only gives me 4 out of 8 of the cells. I have a conection to a database and putting it into a dataset and binding it to the datagrid. Is there a way to either get the total number of columns OR to get the whole row instead of cell by cell?
|
|
|
|
|
For idx As Int16 = 0 To Me.DataGridView1.Columns.Count - 1
MsgBox(Me.DataGridView1.SelectedRows(0).Cells(idx).Value)
Next
|
|
|
|
|
Is this available in 2003
|
|
|
|
|
No...
Do this to get the column count....
Dim iColCount As Int16 = 0
If TypeOf (Me.DataGrid1.DataSource) Is DataSet Then
iColCount = CType(Me.DataGrid1.DataSource, DataSet).Tables(0).Columns.Count
ElseIf TypeOf (Me.DataGrid1.DataSource) Is DataTable Then
iColCount = CType(Me.DataGrid1.DataSource, DataTable).Columns.Count
End If
|
|
|
|
|
How about getting count of columns on dataview as datasource?
|
|
|
|
|
there is a table property...
dim iColCount as int16
iColCount = oView.Table.columns.count
|
|
|
|
|
Can I do this with a Bind?
|
|
|
|
|
Hey
I have two big problems with my project.
I will post the whole code down under my question
What you will need to reproduce this code is a UserControl, on this usercontrol has to be a PictureBox and a Label
The problems are:
1) The mouseLeave Event is fired, even if I don't leave the usercontrol
2) After finishing the Animation, the picture box pops up to full size.
Maybe somone can help me? Here ist the code (VB2005)
<code>
Imports System.ComponentModel
Imports System.Reflection
Imports System.Threading
Public Class ISHilfe
#Region "Properties des Eigenschaftsfensters"
Dim _Bild As Image
< _
Description("Bild für Animation"), _
Category("Misc")> _
Public Property Bild() As Image
Get
Return (_Bild)
End Get
Set(ByVal value As Image)
Try
_Bild = value
pctBox.Image = value
pctBox.SizeMode = PictureBoxSizeMode.StretchImage
Catch
End Try
End Set
End Property
Dim _Labeltext As String
< _
Description("Text des Hilfelabels mit Mini Markup"), _
Category("Misc")> _
Public Property LabelText() As String
Get
Return _Labeltext
End Get
Set(ByVal value As String)
_Labeltext = value
End Set
End Property
#End Region
Dim pctAusblenden As New ThreadStart(AddressOf pctBoxVerkleinern)
Dim pctEinblenden As New ThreadStart(AddressOf pctBoxVergrößern)
Dim lblAusblenden As New ThreadStart(AddressOf lblVerkleinern)
Dim lblEinblenden As New ThreadStart(AddressOf lblVergrößern)
Dim pctFadeOut As New Thread(pctAusblenden)
Dim pctFadeIn As New Thread(pctEinblenden)
Dim lblFadeOut As New Thread(lblAusblenden)
Dim lblFadeIn As New Thread(lblEinblenden)
Private Sub ISHilfe_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
_ControlLabel = Me.lblInfo
_ControlPctBox = Me.pctBox
End Sub
Private Sub ISHilfe_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
lblOriginalSchrift = lblInfo.ForeColor
If pctFadeIn.ThreadState = ThreadState.Running Then
pctFadeIn.Abort()
End If
If lblFadeOut.ThreadState = ThreadState.Running Then
lblFadeOut.Abort()
End If
pctFadeOut.Start()
lblFadeIn.Start()
End Sub
Private Sub ISHilfe_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
If pctFadeOut.ThreadState = ThreadState.Running Then
pctFadeOut.Abort()
End If
If lblFadeIn.ThreadState = ThreadState.Running Then
lblFadeIn.Abort()
End If
pctFadeIn.Start()
lblFadeOut.Start()
End Sub
#Region "Sub pctBoxVerkleinern"
Private Sub pctBoxVerkleinern()
Dim picGröße As Integer = Me.pctBox.Width
PicGrößeOriginalX = pctBox.Size.Width
PicLocationOriginalX = pctBox.Location.X
For i As Integer = pctBox.Location.X To 0 Step -1
Monitor.Enter(Me)
PctBoxNeueLocation(New Point(i, pctBox.Location.Y))
Monitor.Exit(Me)
System.Threading.Thread.Sleep(10) : ctrlPctBoxRefesh()
System.Windows.Forms.Application.DoEvents()
Next
Dim picEndGröße As Integer = Me.Width / 5
For i As Integer = picGröße To picEndGröße Step -1
Monitor.Enter(Me)
PctBoxNeueGröße(New Size(i, i))
PctBoxNeueLocation(New Point(pctBox.Location.X, (Me.Height - pctBox.Height) / 2))
Monitor.Exit(Me)
System.Threading.Thread.Sleep(10) : ctrlPctBoxRefesh()
System.Windows.Forms.Application.DoEvents()
Next
End Sub
#End Region
#Region "Sub pctBoxVergrößern"
Private Sub pctBoxVergrößern()
Dim picGröße As Integer = Me.pctBox.Width
For i As Integer = picGröße To PicGrößeOriginalX Step 1
Monitor.Enter(Me)
PctBoxNeueGröße(New Size(i, i))
PctBoxNeueLocation(New Point(pctBox.Location.X, (Me.Height - pctBox.Height) / 2))
Monitor.Exit(Me)
System.Threading.Thread.Sleep(10) : ctrlPctBoxRefesh()
System.Windows.Forms.Application.DoEvents()
Next
For i As Integer = 0 To PicLocationOriginalX Step 1
Monitor.Enter(Me)
PctBoxNeueLocation(New Point(i, pctBox.Location.Y))
Monitor.Exit(Me)
System.Threading.Thread.Sleep(10) : ctrlPctBoxRefesh()
System.Windows.Forms.Application.DoEvents()
Next
End Sub
#End Region
#Region "Sub lblVergrößern"
Private Sub lblVergrößern()
Dim Schriftfarbe As Color = lblOriginalSchrift
Dim Rot, Grün, Blau As Byte
Rot = Schriftfarbe.R
Grün = Schriftfarbe.G
Blau = Schriftfarbe.B
lblNeueGröße(Me.Width / 2)
For c As Integer = 0 To 255
Monitor.Enter(Me)
lblNeueFarbe(Color.FromArgb(c, Rot, Grün, Blau))
Monitor.Exit(Me)
System.Threading.Thread.Sleep(1)
System.Windows.Forms.Application.DoEvents()
Next
End Sub
#End Region
#Region "Sub lblVerkleinern"
Private Sub lblVerkleinern()
Dim Schriftfarbe As Color = lblOriginalSchrift
Dim Rot, Grün, Blau As Byte
Rot = Schriftfarbe.R
Grün = Schriftfarbe.G
Blau = Schriftfarbe.B
For c As Integer = 255 To 0 Step -1
Monitor.Enter(Me)
lblNeueFarbe(Color.FromArgb(c, Rot, Grün, Blau))
Monitor.Exit(Me)
System.Threading.Thread.Sleep(1)
System.Windows.Forms.Application.DoEvents()
Next
lblNeueGröße(0) : ctrlLabelRefresh()
End Sub
#End Region
Private Sub ISHilfe_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged
If Me.Width <> Me.Height Then
Me.Size = New Size(Me.Width, Me.Width)
End If
Me.Refresh()
Me.pctBox.Size = New Size(Me.Width / 2, Me.Height / 2)
Me.pctBox.Location = New Point((Me.Width - Me.pctBox.Width) / 2, _
(Me.Height - Me.pctBox.Height) / 2)
Me.pctBox.Refresh()
PicGrößeOriginalX = pctBox.Size.Width
PicLocationOriginalX = pctBox.Location.X
End Sub
#Region "Private Properties"
Private _ControlLabel As Control
Private _ControlPctBox As Control
Private ReadOnly Property ControlPctBox() As Control
Get
Return _ControlPctBox
End Get
End Property
Private ReadOnly Property ControlLabel() As Control
Get
Return _ControlLabel
End Get
End Property
' Speichert den hinzuzufügenden Text.
Private _lblNeueGröße As Integer
Private Sub lblNeueGröße(ByVal NeueGröße As Integer)
SyncLock Me
Me._lblNeueGröße = NeueGröße
ControlLabel.Invoke(New MethodInvoker(AddressOf ThreadSafeNeueGröße))
End SyncLock
End Sub
Private Sub ThreadSafeNeueGröße()
Me.ControlLabel.Width = _lblNeueGröße
End Sub
Dim _lblNeueFarbe As Color
Private Sub lblNeueFarbe(ByVal NeueFarbe As Color)
SyncLock Me
Me._lblNeueFarbe = NeueFarbe
ControlLabel.Invoke(New MethodInvoker(AddressOf ThreadSafeNeueFarbe))
End SyncLock
End Sub
Private Sub ThreadSafeNeueFarbe()
Me.ControlLabel.ForeColor = _lblNeueFarbe
End Sub
Dim _lblOriginalSchrift As Color
Private Property lblOriginalSchrift() As Color
Get
Return _lblOriginalSchrift
End Get
Set(ByVal value As Color)
_lblOriginalSchrift = value
End Set
End Property
Private Sub ctrlLabelRefresh()
SyncLock Me
ControlLabel.Invoke(New MethodInvoker(AddressOf ThreadSafeLabelRefresh))
End SyncLock
End Sub
Private Sub ThreadSafeLabelRefresh()
Me.ControlLabel.Refresh()
End Sub
Private Sub ctrlPctBoxRefesh()
SyncLock Me
ControlPctBox.Invoke(New MethodInvoker(AddressOf ThreadsafePctBoxRefresh))
End SyncLock
End Sub
Private Sub ThreadsafePctBoxRefresh()
Me.ControlPctBox.Refresh()
End Sub
Private _PctBoxNeueLocation As Point
Private Sub PctBoxNeueLocation(ByVal NeueLocation As Point)
SyncLock Me
Me._PctBoxNeueLocation = NeueLocation
ControlPctBox.Invoke(New MethodInvoker(AddressOf ThreadSafePctBoxNeueLocation))
End SyncLock
End Sub
Private Sub ThreadSafePctBoxNeueLocation()
Me.ControlPctBox.Location = _PctBoxNeueLocation
End Sub
Private _PctBoxNeueGröße As Size
Private Sub PctBoxNeueGröße(ByVal NeueGröße As Size)
SyncLock Me
Me._PctBoxNeueGröße = NeueGröße
ControlPctBox.Invoke(New MethodInvoker(AddressOf ThreadSafePctBoxNeueGröße))
End SyncLock
End Sub
Private Sub ThreadSafePctBoxNeueGröße()
Me.ControlPctBox.Size = Size
End Sub
Dim _PicGrößeOriginalX As Integer
Private Property PicGrößeOriginalX() As Integer
Get
Return _PicGrößeOriginalX
End Get
Set(ByVal value As Integer)
_PicGrößeOriginalX = value
End Set
End Property
Dim _PicLocationOriginalX As Integer
Private Property PicLocationOriginalX() As Integer
Get
Return _PicLocationOriginalX
End Get
Set(ByVal value As Integer)
_PicLocationOriginalX = value
End Set
End Property
#End Region
Private Sub lblInfo_ForeColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblInfo.ForeColorChanged
lblOriginalSchrift = lblInfo.ForeColor
End Sub
End Class
</code>
|
|
|
|
|
Zero-G. wrote: I will post the whole code down under my question
Just the relevant parts will do. I don't think most people actually have the time to read it all.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Colin Angus Mackay wrote: I don't think most people actually have the time to read it all.
I just did a quick glance, and now I will just walk away for awhile
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I believe the UserControl is firing it's mouseleave event when the mouse goes over the label or picturebox. This is normal. When the event fires you might be able to just check the mouselocation and if it's within the bounds of your control, exit the method. You could also try to get around the problem by doing all the drawing yourself instead of using a picturebox and label.
**EDIT**
The reason it pops up is because of the second loop in this method 'pctBoxVerkleinern'.
Also I believe your going to have some threading issues because you can't start a thread once it's been aborted. In the mouseenter and leave events you need to create a new instance of the thread and then start it.
|
|
|
|
|
Hey
Thanks for taking the time, and take a look to the code.
I will try to change the code, like you told me. - I will answer my progress.
THX
|
|
|
|
|
Hi
I have been playing around with a password hashing scheme for my application
But i keep getting an error message when it executes the command object
i get the error
Unable to cast object of type 'System.byte[]' to type 'system.inconvertible'
Any suggestions?
Sub CreateAccount(ByVal sender As Object, ByVal e As EventArgs)
Dim literror As New LiteralControl
'1. Create a connection
'Create connection string to pass database, string holds login information to mySQL,
Dim connectionString As String
connectionString = "Server=localhost; ;database=ftp1;"
'Builds .net mysql connection and passes connection string into method
Dim connection As New MySqlConnection(connectionString)
Try
'2. Create a command object for the query
Dim strSQL As String = _
"INSERT INTO Useraccount(Username,Password) " & _
"VALUES(?Username, ?Password)"
Dim objCmd As New MySqlCommand(strSQL, connection)
'3. Create parameters
Dim paramUsername As MySqlParameter
paramUsername = New MySqlParameter("?Username", SqlDbType.VarChar, 25)
paramUsername.Value = txtUsername.Text
objCmd.Parameters.Add(paramUsername)
'Encrypt the password
Dim md5Hasher As New MD5CryptoServiceProvider()
Dim hashedBytes As Byte()
Dim encoder As New UTF8Encoding()
hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(txtPwd.Text))
Dim paramPwd As MySqlParameter
paramPwd = New MySqlParameter("?Password", SqlDbType.Binary, 16)
paramPwd.Value = hashedBytes
objCmd.Parameters.Add(paramPwd)
'Insert the records into the database
connection.Open()
objCmd.ExecuteReader()
connection.Close()
Catch ex As Exception
literror.Text = ex.Message
MsgBox(ex.Message)
End Try
Response.Redirect("userhome.aspx")
End Sub
|
|
|
|
|
The code seems seasonable to me, other than you might want to pick a stronger encryption (MD5 is known to be very weak!), and possibly check that the number of bytes comming from the hash will actually fit in the database field and the field is of the correct type to hold the data.
I don't use MySQL, so I don't know what it's going to support and what it's not, or what it's requirements for field types are going to be.
|
|
|
|
|
Dave Kreskowiak wrote: MD5 is known to be very weak!
Yep. Even my coffee is stronger :->
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hey NG
I am looking for a Video Player, which can play different types of Video Format.
For example: mpg, vob, divx, Flash, PowerPoint and so on.
Does anybody know, where I can get something like that, or how to make such a player?
I am using VB2005
Yours faithfully - THX
|
|
|
|
|
There is no player that can play all those formats. Most of the video formats require that codecs be installed, like vob and divx, in order for any player to play them. I don't know of any player that can play ShockWave/Flash AND PowerPoint AND any video stream.
Making a player like this yourself would require a enormous amount of work on your part and a complete understanding of each file format you want to support, like Flash or PowerPoint, and how to parse and render them.
|
|
|
|
|
Hey
Thank you, for reply. - This did not sound good....
Maybe out there someone had the idea to make such a player.
I will look further for informations.
Thank you!
|
|
|
|
|
|
I have a form with a DataGrid and a Listbox. My goal is to do a if statement looking for setting and depending on the outcome, show either the Data Grid OR the listbox by using the visible parameter. When I load the form it correctly shows the correct control by loading a saved file with the setting. I call a method in the same class and pass the value. The problem comes when I use a different form (Different class) and try to pass the setting in again. EX: I want to go to a properties windo and change the settings and have it update the baseform. I see the values going in the method but I don't see the form changing.
Code.
Private Sub frminYardTrucks_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
FileOpen(1, "C:\properties.txt", OpenMode.Input, OpenAccess.Read, OpenShare.LockRead)<br />
<br />
Dim savedProperties As Properties<br />
<br />
Input(1, savedProperties.software<br />
<br />
testSoftwareProperties(savedProperties.software)<br />
<br />
Public Sub testSoftwareProperties(ByVal choice As String)<br />
If choice.Equals("Transact") Then<br />
'MessageBox.Show("Show Grid")Test<br />
Me.lstbxTrucks.Visible = False<br />
Me.TestDataGrid.Visible = True<br />
<br />
Else<br />
'MessageBox.Show("Show Listbox")Test<br />
Me.TestDataGrid.Visible = False<br />
Me.lstbxTrucks.Visible = True<br />
End If<br />
End Sub<br />
<br />
Public Class frmProperties<br />
Inherits Windows.Forms.Form<br />
'Read in file and saved to cmbobxSoftware.Text <br />
Public Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click<br />
Dim test As New frminYardTrucks<br />
test.testSoftwareProperties(cmbobxSoftware.Text.ToString)
When I complete btnSave_Click the frm does not change.
Does it have to deal with Overriding.
|
|
|
|