|
|
|
im working on a vb.net project of 5 forms. 2 forms of these when loaded has a radiobutton that it is checked eventhough they are not selected and also they checked property is set to false,please help me to uncheck these radio button,btw i tried to write the code 'radiobutton.checked=false' at form load and it didnt work.
this problem arised after i ordered the tab from menu/view order tab.
thanks alot.
|
|
|
|
|
zamzoum wrote: 2 forms of these when loaded has a radiobutton that it is checked eventhough they are not selecte
That's because Radiobuttons work by selecting one option out of a list of options. There is not a "no option selected" way for Radiobuttons to work. No matter what you do, the first RadioButton will always be selected by default.
|
|
|
|
|
10x dave for replying,but the default for radio buttons is to be unchecked and the user select his option from the list of radio buttons and that is not my case,i have checked radio buttons on form loading even that their property is set to false,btw in the other forms of my project i do not have this problem.so what can u advise me?
10x alot
|
|
|
|
|
What Dave is saying is not entirely true (at least in vb.net, I don't know about vb6). When you create a form, and add radiobuttons, they will be unchecked by default. When the form is loaded, the radiobuttons will all be unchecked until you make a choice.
The better question however is, why would you want to use radiobuttons and then have them all be unchecked? The basic idea of the radiobutton is to force the user to make a choice. Otherwise you really should consider using checkboxes instead.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Johan Hakkesteegt wrote: When the form is loaded, the radiobuttons will all be unchecked until you make a choice.
Not true. I thought the same thing until I threw a test project together to verify it.
Dropped a GroupBox, or a Panel, it doesn't matter which, on a Form and dropped 5 RadioButtons on the form. Didn't change anything and verified all the Checked properties on all RB's were set to false. I also verified that no funky code showed up in the Designer generated code setting one of them to True. Then I ran the code and watched the first RadioButton get checked automatically.
|
|
|
|
|
Hi Dave,
This might be some sort of version issue, because I tested it myself, first by putting radiobuttons directly onto the form, and after your reply, I tried it with a panel, and I get no checked radiobuttons whatsoever... I tested with VS.NET 2003, .net 1.1, on win XP.
Best Regards,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
I think you may be right. I did this in 2005 and got a checked RadioButton every time.
I'll make up the same exact project in 2003 and see what happens, then convert it to 2005 and see.
|
|
|
|
|
Confirmed it's a version issue.
Under 2003 and .NET 1.1, the RadioButtons do not pick a default selection. They ALL stay unselected with the default configuration.
Under 2005 and .NET 2.0, the first RadioButton gets selected automatically.
|
|
|
|
|
thanks john for replying,i go with u that what dave said is not true,but i guess u didnt understand my problem.
as u said ,radio buttons by default should be unselected,and that is not my case ,when loading my forms some of the radio buttons are checked eventhough i didnt yet make the selection,so i checked the 'checked' property and it is set to false,that what doesnt make sense. as for why not using checkboxes cuz i want to force the client to give 1 choice only.
so what can u advise me to do?
10x alot.
|
|
|
|
|
Why it is behaving like it is, I have no clue. You said it yourself however, the radiobutton's idea is to force the user to make a single choice. I understand from your message that you don't want to have a default choice though.
One possible solution to your dilemma could be to fake it: add an extra radiobutton to the groupbox or panel or whatever, make it the default selected one, and .Visible = False . As an additional advantage you can then also check this radiobutton's checkstate to see if the user remembered to make a choice.
Hope this helps,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi all,
I am trying to extract messages from outlook express on a server and file them in a folder. - contact, subject and text
Does anyone know if this is possible or can direct me to a place where I can get help on this.
Many thanks in advance
|
|
|
|
|
Outlook exposes a COM interface so you can manipulate it - not sure about VB.NET but VBA (yuck) allows this very simply http://www.outlookcode.com/.
I am sure VB.NET allows you to use COM objects so look that up and you will be off to a good start.
Dan
|
|
|
|
|
i want to make crystal report in my windows form project,
i want a report on a table in sqlexpress database
but in the crystal report standard wizard , when i choose new connection ,
i choose OLE DB SQL server
i enter the server's name as "servername\sqlexpress"
and use windows authentication,
i got the following error:
Failed in logon
source: microsoft OLE DB provider for SQL server
Description: Invalid authorization specification
while i enabled all the protocols (via, tcp/ip, pipes,...) in the sql server
|
|
|
|
|
mostafaelfeky wrote: while i enabled all the protocols (via, tcp/ip, pipes,...) in the sql server
Well, you have to enable TCP/IP and remote connections, but you also have to enable Integrated Security.
Other than that, we'd have to see the connection string you're using.
|
|
|
|
|
I'm reading a series of images from a MS SQL table and saving them to directory. As part of the process, I'm resizing the image and changing its resolution from 96 to 72 ppi. The resizing works without a hitch, but I cannot figure out how to reduce the resolution. All of the output files continue to be 96 ppi. Any help would be greatly appreciated.
Here's the code
<snip...>
Dim bytImage() As Byte
bytImage = .ItemArray(4)
bytImage = ChangeImageResolution(bytImage, 72)
bytImage = ResizeImage(bytImage, 150)
Dim fs As New FileStream(strFileName, FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(bytImage, 0, UBound(bytImage))
fs.Close()
fs = Nothing
<snip...>
Private Function ChangeImageResolution(ByVal bytInput As Byte(), ByVal intOutputResolution As Int16) As Byte()
Dim strmInput As New System.IO.MemoryStream(bytInput)
Dim strmOutput As New System.IO.MemoryStream
Dim imgInput As System.Drawing.Image
Dim imgOutput As System.Drawing.Image
Dim bmapTemp As Bitmap
' Create a temporary bitmap and set to output resolution
imgInput = System.Drawing.Image.FromStream(strmInput)
bmapTemp = imgInput
bmapTemp.SetResolution(intOutputResolution, intOutputResolution)
imgOutput = New Bitmap(bmapTemp)
imgOutput.Save(strmOutput, System.Drawing.Imaging.ImageFormat.Jpeg)
' Return the output image in a byte array
ChangeImageResolution = strmOutput.ToArray
End Function
Private Function ResizeImage(ByVal bytInput As Byte(), ByVal intFinalMaxDim As Int16) As Byte()
Dim strmInput As New System.IO.MemoryStream(bytInput)
Dim strmOutput As New System.IO.MemoryStream
Dim imgInput As System.Drawing.Image
Dim imgOutput As System.Drawing.Image
Dim intMaxDim As Int16 = 0
Dim intResizePercentage As Double = 0
Dim sizResize As New Size
' Determine the resizing percentage based on current image dimensions
imgInput = System.Drawing.Image.FromStream(strmInput)
If imgInput.Height >= imgInput.Width Then
intMaxDim = imgInput.Height
Else
intMaxDim = imgInput.Width
End If
intResizePercentage = (intFinalMaxDim / intMaxDim)
With sizResize
.Width = CInt(imgInput.Width * intResizePercentage)
.Height = CInt(imgInput.Height * intResizePercentage)
End With
' Create a new resized version of the image
imgOutput = New Bitmap(imgInput, sizResize.Width, sizResize.Height)
imgOutput.Save(strmOutput, System.Drawing.Imaging.ImageFormat.Jpeg)
' Return the output image in a byte array
ResizeImage = strmOutput.ToArray
End Function
|
|
|
|
|
The dpi is just metadata in the image. It has no effect on the display, printing, or quality of the image. It's kind of like a footnote.
|
|
|
|
|
Dave,
Thanks for your response. Sorry about the ppi/dpi confusion – my graphics app uses "ppi" and Windows uses "dpi".
To further clarify my problem...these are staff ID pictures from our security card app. Once I've extracted the ID photo from the security app to disk, I need to reference the disk file in our HR app. The images are not printed from the HR app, but if they are not at a 72 dpi resolution, the HR app freezes. Somehow I've got to figure out how to change the resolution.
|
|
|
|
|
There's a picture in a program (not mine). How can I simulate a click on the picture? (I know the coordinates)
Thanks,
SMA
|
|
|
|
|
There is no "SendMouse" or "SendClick" so you have to use the Win32 API functions FindWindowEx to get the window that the image is in, get it's window handle, then use the API function SendMessage to send carefully crafted WM_LBUTTONDOWN and WM_LBUTTONUP messages to that window.
Warning: This is NOT something for beginners!! You have to have specific knowledge of how Windows works and how your application works. If you don't have sufficient research skills, you'll find this a very frustrating experience.
|
|
|
|
|
Hi,
I'm looking for a guide to create a wizard on VB 2003.
I did find many articles and guides how to create wizards in C++\C#\VB2005, but not a single one besides from microsoft's guide (which I didnt understand much of):
http://msdn2.microsoft.com/en-us/library/7k3w6w59(vs.71).aspx[^]
Must I mention that I'm new to VB, and if anyone could explain to me how to, and what to, that'd be greate. PLEASE PLEASE PLEASE.
|
|
|
|
|
The link you posted doesn't create a Wizard, but is a Wizard that helps you create an Add-In for Visual Studio.
Have you tried looking at the code in this article[^]?
|
|
|
|
|
I am working with Visual Studio 2005 w/ Service Pack 1 for Vista
I experienced a crash in Vista last night while "playing" my app. As it was the end of the day, I did not log back in and went home.
I came back in today, opened my solution and now am greeted by a friendly message from Visual Studio when I attempt to open the form [design] telling me that "The file cannot be opened with the selected editor. Please choose another editor. "
If I build the project, I get an error saying "String cannot have zero length" The file specified is "LC" (which is not the name of anything I have in my solution.). No line number is listed, nor column.
I am able to open the code for the form, the form designer, and a separate form in my solution.
I've Googled the error and so far found nothing that is of any help.
I am hoping that the good people of Code Project have seen this before and might know of how I can track down what is causing the problem or a fix.
Thanks in advanced!
-Steve
|
|
|
|
|
I don't use Vista, and haven't seen that problem under XP yet either.
The first thing I'd try would be to close the Solution, go into the Projects folder and delete the .SUO file (which is normally hiddden). Then try reopening the project.
After that, I would suspect that one of the files for that form has been corrupted somehow. I'd probably try salvaging the code for the form by opening its .vb file in Notepad and copying it to another file, then delete the form from the project, making sure the .vb, .resx, and .designer.vb files are removed, then recreate then form with all the controls using the same names you used before. You can copy and paste the code you salvaged back into the form's code.
|
|
|
|
|