|
It's a heck of a lot easier to replace the keyboard or just buy ($10 US) a normal desktop keyboard and plug that into the laptops keyboard port.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you very much for your suggestion. But my computer need to present in the public, so I can't purchase additional keyboard because it would make me difficult to bring it with me when i travel. Now I decide to use automatitc logon to my computer when the keyboard become normal. Thank you and happy new year!!!
|
|
|
|
|
I have a click event for multiple buttons
i.e but1, but2, but3, etc...
Private Sub Buttons_Click(ByVal sender As System.Object, ByVal e as System.EventArgs) Handles but1.click, but2.click, but3.click
End Sub
(you get the idea)
What I want to do is determine the exact button that was clicked.
I tried this...
dim con as new control
if con.gettype.name = "Button" then
output.text = con.text
end if
obvisously no luck.
Any pointers for a novice?
|
|
|
|
|
tbryce311 wrote: I tried this...
dim con as new control
That will only create a new unused control, that has nothing to do with any of the controls in your form.
The sender argument contains a reference to the control that caused the event. Cast it to the type of your control.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
Again I am a novice... so I am trying to understand the concept/terminology of what is going on here.
The sender is system.windows.forms.button
Under control it is System.Windows.Forms.Control.ControlCollection
Assuming I am following the information that you wrote correctly the control that would have caused the event would be Owner/Name: "but1"
There is not a type listed under the Control.ControlCollection.
I do not follow "Cast it to the type of your control"
|
|
|
|
|
If your button click event handler:
If TypeOf (sender) Is Button Then
Dim cb As Button = DirectCast(sender, Button)
' Do whatever you want with the button. cb is
' now the button that was clicked.
End If
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
The sender parameter is a reference to the instance of the control that caused the event, not just the type of the control.
If the sender is a Button, cast the reference to Button, and you have a reference to the button that was clicked:
Button senderButton = DirectCast(sender, Button)
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
if(((Button)sender).Text="Button")
{
output.text=((Button)sender).Text;
}
or
Button con=(Button)sender;
if(con.Text="Button")
{
output.text=con.Text;
}
You don't have the con variable defined so I am assuming the event handlers object paramter is sender. The code is in C#, but you should still get the general idea.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi I have the following code that hides a drive depending on the check status.
Private Sub Hide_Drive()<br />
<br />
Dim DriveStr As String = ""<br />
Dim Regkey As RegistryKey<br />
Dim DArr As New ArrayList<br />
Dim i As Integer<br />
Dim Cnt As Integer = 0<br />
<br />
For i = 0 To Chlsb_Drives.CheckedItems.Count - 1<br />
Select Case Chlsb_Drives.CheckedItems(i).ToString()<br />
Case Is = "A"<br />
Cnt += 1 : DriveStr &= "A"<br />
Case Is = "B"<br />
Cnt += 2D : DriveStr &= "B"<br />
Case Is = "C"<br />
Cnt += 4D : DriveStr &= "C"<br />
Case Is = "D"<br />
Cnt += 8 : DriveStr &= "D"<br />
Case Is = "E"<br />
Cnt += 16 : DriveStr &= "E"<br />
Case Is = "F"<br />
Cnt += 32 : DriveStr &= "F"<br />
Case Is = "G"<br />
Cnt += 64 : DriveStr &= "G"<br />
Case Is = "H"<br />
Cnt += 128 : DriveStr &= "H"<br />
Case Is = "I"<br />
Cnt += 256 : DriveStr &= "I"<br />
Case Is = "J"<br />
Cnt += 512 : DriveStr &= "J"<br />
Case Is = "K"<br />
Cnt += 1024 : DriveStr &= "K"<br />
Case Is = "L"<br />
Cnt += 2048 : DriveStr &= "L"<br />
Case Is = "M"<br />
Cnt += 4096 : DriveStr &= "M"<br />
Case Is = "N"<br />
Cnt += 8192 : DriveStr &= "N"<br />
Case Is = "O"<br />
Cnt += 16384 : DriveStr &= "O"<br />
Case Is = "P"<br />
Cnt += 32768 : DriveStr &= "P"<br />
Case Is = "Q"<br />
Cnt += 65536 : DriveStr &= "Q"<br />
Case Is = "R"<br />
Cnt += 131072 : DriveStr &= "R"<br />
Case Is = "S"<br />
Cnt += 262144 : DriveStr &= "S"<br />
Case Is = "T"<br />
Cnt += 524288 : DriveStr &= "T"<br />
Case Is = "U"<br />
Cnt += 1048576 : DriveStr &= "U"<br />
Case Is = "V"<br />
Cnt += 2097152 : DriveStr &= "V"<br />
Case Is = "W"<br />
Cnt += 4194304 : DriveStr &= "W"<br />
Case Is = "X"<br />
Cnt += 8388608 : DriveStr &= "X"<br />
Case Is = "Y"<br />
Cnt += 16777216 : DriveStr &= "Y"<br />
Case Is = "Z"<br />
Cnt += 33554432 : DriveStr &= "Z"<br />
End Select<br />
Next<br />
'save drives' setting in registry<br />
Regkey = Registry.CurrentUser.CreateSubKey("Software\Hide Drive")<br />
Regkey.SetValue("Cnt", Cnt)<br />
Regkey.SetValue("Drives", DriveStr)<br />
Regkey.Close()<br />
' Update registry key<br />
Regkey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", True)<br />
Regkey.SetValue("NoDrives", Cnt)<br />
Regkey.Close()<br />
<br />
End Sub
I can't figure out how to check the items back when I load the form.
Can someone help?
Thank you
|
|
|
|
|
guayony wrote: I can't figure out how to check the items back when I load the form.
What do you mean check the items back???
|
|
|
|
|
How do you make a button,
1)change the name displayed to the user when a user clicks it
2)make 10 images rotate in a picture box using timers.
Ex. button says 'move', user clicks, 10 images rotate to timer and button name changes to 'stop'. Users clicks 'stop', images stop rotating and button changes to 'move'?
I am using VS 2003
Skullie
|
|
|
|
|
On your form, add your picturebox, your button, an imagelist and a timer. In the code i will be giving you, everything is named to default (e.g. button1, picturebox1, imagelist1, timer1), you will have to rename these if your's are named different.
Do this in declarations:
Dim ICount As Integer = 0 ' declare the counter for our images
Form Load:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Me.PictureBox1.BackgroundImage = Me.ImageList1.Images.Item(0) ' Set the picture box to display the first image in the series<br />
Me.PictureBox1.BackgroundImageLayout = ImageLayout.Stretch ' Make the image stretched ''This is optional<br />
End Sub
Button Click:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
If Me.Button1.Text = "move" Then ' if the timer isn't running and the text = "move" then<br />
Me.Button1.Text = "stop" ' change the text<br />
Me.Timer1.Enabled = True ' and start the timer<br />
Else ' if it is running and the text = "stop" then<br />
Me.Button1.Text = "move" ' change the text<br />
Me.Timer1.Enabled = False ' and stop the timer<br />
End If<br />
End Sub
Timer Tick:
<br />
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
'index for images starts at zero, so on the tenth image the index will be 9, so we have to minus one to accomodate<br />
If ICount = Me.ImageList1.Images.Count - 1 Then 'Check if it's at the last image, and start again if so<br />
Me.PictureBox1.BackgroundImage = Me.ImageList1.Images.Item(0) ' change to first image<br />
ICount = 1 'set the count for the next image<br />
Else<br />
Me.PictureBox1.BackgroundImage = Me.ImageList1.Images.Item(ICount) ' if it's not the last image, go to next image<br />
ICount += 1 'set the count for the next image<br />
End If<br />
' the icount is an integer that is increased after each change, then each subsequent change will be the next image in series<br />
End Sub<br />
Posted by The ANZAC
|
|
|
|
|
Thank you so much,
There were a couple of things I was not doing. I didn't create an image list, I was trying to import through system.drawing... and I was placing that coded in the button_click event, not on form load. Your help is greatly appreciated. Obviously I am a newbie to vb.net!
Skullie
|
|
|
|
|
No Problem, happy to help. If your a newbie, maybe you should try some learning resources, i recommend this:
http://msdn.microsoft.com/vstudio/express/vb/learning/default.aspx[^]
It got me on my feet to start programming. You can watch all or just a few. There are some down the buttom that provide insight into the different controls available, when and how to use them. I suggest you check these out, each of them is only short (5-10 mins). The top ones take you through a whole project, each is about 20-50 mins.
Posted by The ANZAC
|
|
|
|
|
How do i use the richtext boxes in VB .NET so as to support graphic files like jpg, gif, etc.?
Also i need to save these richtextbox's data (including pictures and graphics) in MS-Access and need to retrieve it in the same pattern or form as it is entered....
I am using the Visual Studio 2005.
kindly help me out.
Nirav
|
|
|
|
|
Hi,
First off all, I'm new to programming. Yes, I'm a newbie.:-> Just made my first steps reading text files using StreamReader or FileOpen.
When I open an mp3 file in Notepad, the first couple of bytes are the id3 tag information. It's just plain text sepparated by an unknown character. I guess it's this unknown character () where the read chokes, cause I just can't read the file using FileOpen or StreamReader, not completely anyway. I took a look at the ID3v11 class I found around here. It seems to read the end of the file, but the tag is at the beginning. Right?
Using peaces of code of this class I get some text, but it's choped and incomplete.
Dim strFileName As String = "c:\test01.mp3"
Dim strTag As New String(" ", 3)
Dim strTitle As New String(" ", 30)
Dim strArtist As New String(" ", 30)
Dim strAlbum As New String(" ", 30)
' Open the file
Dim intFile As Integer = FreeFile()
FileOpen(intFile, strFileName, OpenMode.Binary, OpenAccess.Read, OpenShare.LockWrite)
FileGet(intFile, strTag)
FileGet(intFile, strTitle)
FileGet(intFile, strArtist)
FileGet(intFile, strAlbum)
TextBox1.Text = strTag & vbCrLf & strTitle & vbCrLf & strArtist & vbCrLf & strAlbum
FileClose(intFile)
What does this do 'As New String(" ", 3)'?
Why can't I read an mp3 file like Notepad does?
Please help a newbie out.
|
|
|
|
|
SilentBob101 wrote: I guess it's this unknown character () where the read chokes, cause I just can't read the file using FileOpen or StreamReader, not completely anyway.
You can't read the ID3 data as plain text, use a BinaryReader.
SilentBob101 wrote: It seems to read the end of the file, but the tag is at the beginning. Right?
There can be a ID3 version 1.x tag at the end of the file, and/or there can be a ID3 version 2.0 tag at the beginning of the file.
SilentBob101 wrote: Using peaces of code of this class I get some text, but it's choped and incomplete.
The 1.x version tag has limited field sizes, so if the data in the 1.x version tag is a copy of the data in the version 2.0 tag, it will be cropped if any text is longer than 30 characters.
SilentBob101 wrote: What does this do 'As New String(" ", 3)'?
It declares the string variable and creates a three character long string filled with spaces. The length of the string is only used to determine how much data to read from the file, initializing the string serves no other purpose at all in this case. To use the string length in this way comes from VB6, and doesn't really make sense in VB.NET. This code is either a straight conversion from VB6, or written by a former VB6 coder that hasn't learned much about VB.NET yet.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
i have created a website but i am facing problem to create option "remember password on same computer"
if anyone have idea or code to use the same option please send me.
thank you!!!
contact me: ashish.0619@gmail.com
|
|
|
|
|
|
Sir/Madam,
Either u can use cookies or create a new file and dtore the username and password into that for the concerned user.
Hope this will help u.
Thanks and Regards
Pankaj
|
|
|
|
|
Ashish Porwal wrote: contact me: ashish.0619@gmail.com
NO ! go to hell with your email. if you didn't understand the interest of a forum, you have nothing to do here...
|
|
|
|
|
how to insert the data in MS access
ugandhar
|
|
|
|
|
well you can use quite lot of choices. you can directly add the row into database using sql or just using dataset
|
|
|
|
|
i created a project.Initially, i didnt change the webpage's name. it's by default the same as webform1.aspx.
the problem is:
=-=-=-=-==-=-=--=-
i did change the name of the webpage to students.aspx, and i debugged it. I got an error like:
Server Error in '/description/details' Application.
--------------------------------------------------------------------------------
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested Url: /description/details/WebForm1.aspx
experts,please help me! in this context.
thanks
tirumal
|
|
|
|
|
Use find and replace on the entire project for
WebForm1.aspx
Replace with
students.aspx
|
|
|
|