|
Thanks. Do you know of a property for the client area only?
|
|
|
|
|
Ok, i've come up with this:
Dim y As Integer = Me.Bounds.Height / 2 - Me.GroupBox1.Height / 2<br />
Dim x As Integer = Me.Bounds.Width / 2 - Me.GroupBox1.Width / 2<br />
Me.GroupBox1.Location = New Point(x, y)
This will center your control, in this case, a groupbox within the forms client area. However ther may be one drawback (depending on how you see it). If you have a docked menu at the top of your form, the control will center itself between the bottom of the form and the menu. I'm guessing the same goes for any docked menu on any side. Other than that, i think this works quite well.
Posted by The ANZAC
|
|
|
|
|
Hi,
I have to import data from .csv file (which contains 4 different columns like firstname,lastname,DOB,SSN) into Oracle database by using vb.net and asp.net(web application). This .csv file is very bulky file which may containts upto 10,000 rows.
Can any body tell me that what is the faster way to do it thru web page.
Any sample code or link is available which solve this issue than it would be very much helpful to me.
regd,
montu3377
|
|
|
|
|
Hi, I have an old laptop which is running windows xp professional. I have a problem with my keyboard that the M and N key seem not to be funtion sometime. I need to press it very hard in type M or N character.
If I work in windows, it doesn't has any problem becuase I could use the utitlity call On screen keyboard to type this character. But when I start logon or my computer is lock and need to unlock and this key is the part of my password or username, it is really make me in trouble.
From here, I would like to write my own software or find any software that attach itself to winlogon.exe which consist of small button if i could not type my keyboard they i will use this button to load an on screen keybaord or other tool that i could click on the character that I could not type. I used to use windows xp tablet pc edition and i found that Microsoft have attach the keybaord button for user to use the pen to type it.
Does anyone has any idea?
|
|
|
|
|
The winlogon.exe is a Microsoft Windows program that has the key functionality of the logon interface. I do not believe it will be possible or wise to alter or enhance the program that may leave security holes in the OS (I have know idea whether what you are thinking will or will not, but it is still a possibility). Their are some programs that I know add some functionality to the winlogon.exe program to customize the interface or add alternative login forms (examples: fingerprint reader or LogonStudio from a Windows Skinning company), but I don't know how exactly they do it.
It may be easier to just change the password or username. Or for that matter get a new keyboard if the keyboard is really interfering with your productivity.
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[ ^]
|
|
|
|
|
Thank you very much for your suggestion. I think I might use automatic logon when my keyboard came to normal. I can't purchase an external keyboard because sometime I need to make a presentation with this laptop on the road.
Thank again for your suggestion. Happy new year!!!
|
|
|
|
|
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
|
|
|
|
|
|