|
use following statement
frmChild.showDialog()
in place of
marygoldg wrote: frmChild.show()
hope this helps
|
|
|
|
|
If You are Using a MDI form and a Normal Form, then Always two forms are enabled.
because, other form is opened with in the MDI form
Arindam Banerjee
Rance Computer Pvt Ltd.
Kolkata (India)
|
|
|
|
|
MDI standards for Multiple Document Interface. Say you were creating a new version of Notepad, where you were able to open multiple documents in the same editor window. That editor window is the MDI Parent form and the documents are the MDI children. You cannot disable the MDI Parent form and keep the child forms enabled. Otherwise, the children forms will also be disabled.
It sounds like you should not be using an MDI Child form, it should be its own form.
|
|
|
|
|
When I clicked on a button a form is getting opend with in the MDI parent forms.But the problem is the controls on the parent form are hiding the controls on the child form.I could not able to find out where the mistake is .Could you please suggest .
|
|
|
|
|
The mistake is in your design combined with not understand how MDI works.
MDI Parent forms have a control on them, automatically, that takes up the entire client area of the form. This control is called the MDIClient (the dark gray area) and it sits docked to all of the free space on the form. It also sits behind all other controls on the form. This control handles rendering and management of all of your MDI Child forms. When you create a child form, it gets shown inside this MDIClient control.
Now, since the MDIClient control sits behind all other controls on the MDI Parent form, this is why you're getting the results you're seeing. The quick solution is simple, don't put controls on the MDI Parent form.
The harder solution is to, in code, find the MDIClient control in the MDI Parent form's Controls container, undock the MDIClent control, move the MDI Parent controls to the edge of the form, then set the Location and Size properties of the MDIClient to somewhere where your MDI Child forms will still be visible and you can still get to the MDI Parent controls.
|
|
|
|
|
I need some help with saving and retrieving images with microsoft sql server.
I have created a form that captures personal information and a picture.
I am having problems with how to saving this data with the picture.
I will also like to display this data at a later time or in another form.
Please help.
|
|
|
|
|
|
hi,
follow step by step
1. first of all i assume PictureBox1 hold the picture data. So use following statement
Dim PictureBox1Data As Byte()<br />
If PictureBox1.Image Is Nothing Then<br />
PictureBox1Data = Nothing<br />
Else<br />
PictureBox1Data = imageToByteArray(PictureBox1.Image)'See below this function<br />
End If
2.Now write the SQL query as following
Dim QueryText As String<br />
Dim QueryValue As String<br />
Dim command As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand()<br />
QueryText = "INSERT INTO Settings(PrintCompany,IsUploadLogo,LogoGraphic )"<br />
QueryValue = "Values(@PrintCompany, @IsUploadLogo,@LogoGraphic)" <br />
command.CommandText = QueryText & QueryValue<br />
3. Supply Value to parameter which is in above query, as following
command.Parameters.Add("@PrintCompany", SqlDbType.TinyInt, 10).Value = True<br />
command.Parameters.Add("@IsUploadLogo", SqlDbType.TinyInt, 10).Value =True<br />
If Not PictureBox1Data Is Nothing Then<br />
command.Parameters.Add("@LogoGraphic", SqlDbType.Image, PictureBox1Data.Length).Value = PictureBox1Data<br />
Else<br />
command.Parameters.Add("@LogoGraphic", SqlDbType.Image, 0).Value = System.DBNull.Value<br />
End If
4. Execute query as following
command.ExecuteNonQuery()
step 1 to 4 read data of picture box,convert them byte array and store in related table.Step 1 use following function to convert an image into byte array
Public Function imageToByteArray(ByVal ImageIn As System.Drawing.Image) As Byte()<br />
Dim ms As MemoryStream = New MemoryStream()<br />
Dim FormatImage1 As Imaging.ImageFormat = ImageIn.RawFormat<br />
ImageIn.Save(ms, FormatImage1)<br />
'ImageIn.Save(ms, Imaging.ImageFormat.Bmp)<br />
Return ms.ToArray()<br />
End Function
5. Now Use following statement to get dataset
str = "select * from Settings"<br />
Dim ds As New DataSet<br />
ds = mdIns.GetResultFromQuery(str)'this function return dataset<br />
6. use dataset record as following
If ds.Tables(0).Rows.Count > 0 Then<br />
chkPrintCompanyName.Checked = CBool(ds.Tables(0).Rows(0).Item(0))<br />
chkLogoGraphic.Checked = CBool(ds.Tables(0).Rows(0).Item(1))<br />
If Not IsDBNull(ds.Tables(0).Rows(0).Item(4)) And Not ds.Tables(0).Rows(0).Item(2) Is Nothing Then<br />
PictureBox1.Image = ByteArrayToimage(ds.Tables(0).Rows(0).Item(2))<br />
End If<br />
<br />
End If
step 6 use following function for convert Byte array to Image
Public Function ByteArrayToimage(ByVal ImageArray As Byte()) As Image<br />
Dim ms As MemoryStream = New MemoryStream(ImageArray)<br />
Dim ReturnImage As Image = Image.FromStream(ms)<br />
Return ReturnImage<br />
End Function
hope this helps
|
|
|
|
|
I have got same issue exactly,
while retrieving image from Database to PitcureBox getting error saying that "Parameters is Not Valid", it is look like there is an issue when save the image and converted to string in DB, hope to have some solutions,
|
|
|
|
|
If I run this code from my computers hard drive, C:\, it detects the networked mapped drive, J:\, just fine:
Private Function FolderExists() As Boolean
Return My.Computer.FileSystem.DirectoryExists("J:\Template_Alpha\")
End Function
' Outputs: True
But when I copy the same VB.NET project to the network mapped J:\ drive, the output changes to False . The project is located in a different folder on the J:\ drive and is not a sub folder of J:\Template_Alpha\.
I'm running VS 2008
Is there some kind of network permissions in Visual Studio I have to set to get this code to work?
-Hazelrah
|
|
|
|
|
Try using System.IO instead of filesystem:
Private Function FolderExists() As Boolean
Return System.IO.Directory.Exists("J:\Template_Alpha\")
End Function
no guarantees though...
My advice is free, and you may get what you paid for.
|
|
|
|
|
Unfortunatly that didn't help. I'm pretty certain those two functions resolve to the same CLR code.
I remember having this problem before and I'm pretty certain it's a security thing, but I can't for the life of me find the settings.
Anyone else have an idea?
-Hazelrah
|
|
|
|
|
Can i expoert my Sqldata to a notepad in comma seperated forms and import the same to sql in vb6
|
|
|
|
|
Yes. Just write some code to do it.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
... and if at all possible, forget vb6 and start using .NET (Visual Studio 2008 Express editions are free for download)
My advice is free, and you may get what you paid for.
|
|
|
|
|
I need a sample code for email attachment
|
|
|
|
|
Good for you. I don't.
Motivation is the key to software development.
|
|
|
|
|
I have some - so do lots of people. Some even share it. Try searching CP or Google.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
mighty_mouse wrote: need a sample code for email attachment
I need a brain. If I only had a brain... Do you think, the wizard of Oz has a brain for me?
|
|
|
|
|
The wizard got an HTTP 404 error when trying to upload it to you.
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 Blog
|
|
|
|
|
Error 404 - cranial cavity not found
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
Only because I'm feeling helpful today :-
Dim oMail As New System.Net.Mail.MailMessage("senders@emailaddress.com", "reciepients@emailaddress.com")
oMail.Priority = Net.Mail.MailPriority.Normal
oMail.Subject = "My Subject"
oMail.Attachments.Add(New System.Net.Mail.Attachment("C:\My Documents\MyFile.Doc"))
oMail.IsBodyHtml = False
oMail.Body = "Please the file attached."
Dim smtp As New System.Net.Mail.SmtpClient("smtp.mailserver.net")
smtp.Credentials = New System.Net.NetworkCredential("myUserName", "MyPassword")
smtp.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
smtp.Send(oMail)
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Hi Friends,
Actually I want to Do Image Encryption and Image decryption but I really dont have so much concept for that,I have seen the Article Given by sudhakar79 but in that Article I Dont Know where did he got the Encrypted Data or how he did the Encryption.I looking for a Image Encryption and Decryption Program that must include the capability of adding Some Text in that encrypted data and then I can Decrypt That Data......I need Some Basic Details.......Can Any body Help Me Please
|
|
|
|
|
An image is just like any other binary file. Search codeproject for file encryption articles. There are quite a few.
What you are actually talking about doing is steganography.
|
|
|
|
|
Yes Dear Exactly I am talking about steganography where I have to Hide my Text Data behind an Image..........So dear Can you plz Help Me in This Context.......
|
|
|
|