|
Is there a way to add images here? The problem is, while all controls (user control and the 2 buttons on it) have their backcolor property set to Color.Transparent, when I run it, it's not transparent. The background shows an image of wherever my mouse moves on main form. I think the background of the user control does not refresh properly, but I am not sure how to handle this.
For example, if my mouse is on Button 1, then the background of Button 2 changes to the image on Button 1.
|
|
|
|
|
You need to create a simple text application to try and figure out where the problem is. Make a simple form with no more than three controls, in a similar configuration to what you have already. Then run some tests and see if you can identify the exact circumstances of the problem.
|
|
|
|
|
The problem with Transparent is that it isn't.
Transparent only tells the control to take on the background properties of the control that contains it.
Using the properties of the controls in Windows Forms, you CAN make the entire form really transparent, but you can only make the ENTIRE form, along with ALL of its contents, transparent. You cannot single out a control to be not transparent.
It can be done using calls to Win32 functions. Start reading these[^].
|
|
|
|
|
With Microsoft office access not using MySQL i am using binding source i cant store it. please help me for my thesis, thank you so much...
Jun Joseph
|
|
|
|
|
You'll want to execute a parameterized INSERT statement against an OleDbConnection.
|
|
|
|
|
It is ALWAYS a bad idea to store images in an Access database. It is much better (and easier) to keep the images in a directory and just store the name and path to the file in the database.
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Chris Quinn wrote: It is ALWAYS Not always.
It may be very beneficial to have them grouped in a single repository that is easy to back up. It might also be a bit easier to secure than a bunch of directories and files.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I think Chris's idea is good. Just store the image's path to the the table i.e
cmd.Parameters.AddWithValue("@Imgpath", "~/Uploadedimages/" + StrImgName)
from the above, uploadedimages is a folder located at your project's directory and StrImgName is the image name you captured from the filedialog event.
|
|
|
|
|
Pls HELP me How to print data from datagridview bind on access database. I'm badly need your help. i'm a beginner,
|
|
|
|
|
Research the PrintDocument[^] class.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Well my previous post, the await part didn't work, and it operated synchronously.
The main code was suppose to pause and wait for the download to complete and the program to install before moving forward, but just ran to the end.
The previous code I wrote had awaits everywhere in the main code. I really just wanted to call a class that would do the whole thing for me in 1 shot, while the main code waits for the class to finish.
I'm not really sure what this is called in .NET to look up info; perhaps a delegate. And how to adjust my code, and get rid of the await if I have to.
Calling the class, I use to have the await here as well, but then the await kept going up the chain, until finally everything was an await task in the main program - hard to explain.
I didn't think it would be this hard, and I'm having trouble sifting through all the information on the net, and choosing the proper direction / method to take.
Dim localDB_Url_X64 As String = "http://care.dlservice.microsoft.com/dl/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/LocalDB%2064BIT/SqlLocalDB.msi"
Dim localDB_Url_X86 As String = "http://care.dlservice.microsoft.com/dl/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/LocalDB%2032BIT/SqlLocalDB.msi"
Dim desktop_Save As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\SqlLocalDB.msi"
Dim dCB As New download_callback
dCB.httpWebRequest_With_Progress(
New Uri(localDB_Url_X64).ToString,
desktop_Save,
lbl_localDB_Progress,
pbLocalDB
)
My Class - I really just wanted to call this class, and wait for it to finish, but be able to update my progress bar and label. It's a pretty long task, perhaps 10 minutes or so.
The code in the class actually works correctly, and does what I want, just doesn't pause and wait.
Public Class download_callback
Public Async Function httpWebRequest_With_Progress( _
ByVal url As String,
ByVal s As String,
ByVal pLabel As Label,
ByVal pBar As ProgressBar) As Task(Of Integer)
Dim desktop_Save As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\SqlLocalDB.msi"
Dim webClient As Net.HttpWebRequest = DirectCast(Net.HttpWebRequest.Create(url), Net.HttpWebRequest)
webClient.AllowAutoRedirect = True
Dim resp = Await (New TaskFactory(Of Net.WebResponse)).StartNew(AddressOf webClient.GetResponse)
pBar.Value = 0
pBar.Maximum = CInt(resp.ContentLength)
Dim rqs = resp.GetResponseStream
Dim bufferSize As Integer = 1 << 16
Dim buffer(bufferSize) As Byte
Dim bytesRecieved As Integer = 0
Dim bytesTotal As Integer = 0
Dim fs As New FileStream(desktop_Save, FileMode.Create)
Do
bytesRecieved = Await (New TaskFactory(Of Integer)).FromAsync(AddressOf rqs.BeginRead, AddressOf rqs.EndRead, buffer, 0, bufferSize, Nothing)
bytesTotal += bytesRecieved
fs.Write(buffer, 0, bytesRecieved)
Dim m_Bytes As String = "Downloading " & (Convert.ToDouble(bytesTotal) / 1048576).ToString("0.00") & " MB" & " / " & (Convert.ToDouble(pBar.Maximum) / 1024 \ 1024).ToString("0.00") & " MB"
pLabel.Text = m_Bytes
pBar.Increment(bytesRecieved)
Loop Until bytesRecieved = 0
If Not fs Is Nothing Then
fs.Close()
fs.Dispose()
End If
If Not rqs Is Nothing Then rqs.Close()
If Not resp Is Nothing Then resp.Close()
frmSetup.lbl_localDB_Title.Text = "Installing Microsoft SQLLocalDB.msi"
pLabel.Text = "Installing SQLLocalDB - Please Wait"
pBar.Value = 0
'Install the Microsoft LocalDB Software
Using localDB As Process = New Process()
Dim localDB_PS As New ProcessStartInfo
localDB_PS.FileName = desktop_Save
localDB.EnableRaisingEvents = True
AddHandler localDB.Exited, AddressOf localDB_Exited
localDB.StartInfo = localDB_PS
localDB.Start()
Do
'Do Nothing, just wait and enjoy the ride
If Not localDB.HasExited Then
pBar.Value = If(pBar.Value < 99, pBar.Value = pBar.Value + 0.1, 0)
End If
Loop While Not localDB.WaitForExit(1200000)
End Using
Return bytesTotal
End Function
Private Sub localDB_Exited(ByVal sender As Object, ByVal e As System.EventArgs)
' Your code goes here
End Sub
End Class
Sorry for all the code, Just wanted to make sure the picture was complete, I rarely post this much code.
|
|
|
|
|
jkirkerx wrote: dCB.httpWebRequest_With_Progress(...)
Your httpWebRequest_With_Progress function returns a Task(Of Integer) . If you want the calling code to pause and wait for the method to complete before continuing, you'll need to Await the returned task.
Await dCB.httpWebRequest_With_Progress(
New Uri(localDB_Url_X64).ToString,
desktop_Save,
lbl_localDB_Progress,
pbLocalDB
)
jkirkerx wrote: Dim resp = Await (New TaskFactory(Of Net.WebResponse)).StartNew(AddressOf webClient.GetResponse)
jkirkerx wrote: bytesRecieved = Await (New TaskFactory(Of Integer)).FromAsync(AddressOf rqs.BeginRead, AddressOf rqs.EndRead, buffer, 0, bufferSize, Nothing)
You shouldn't use the TaskFactory to call synchronous methods on a new background thread:
Should I expose asynchronous wrappers for synchronous methods?[^]
Instead, use the asynchronous methods:
Dim resp = Await webClient.GetResponseAsync()
...
bytesRecieved = Await rqs.ReadAsync(buffer, 0, bufferSize)
Perhaps this walkthrough[^] might help.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I thought that was async.
Thanks for the clarification on that.
Read the articles, It's going to take some more practice and experience to really understand async threading and how to properly implement it.
Now I' wondering if my web browser crawler should run async.
Haven't got rid of the child windows yet, but I will start dumping them 1 at a time, starting with the simplest one first, so I can get the hang of it.
Hey, Thanks for the help, and taking the time to make my skills better on this. I really appreciate it.
Just out of curiosity, why are those child MDI windows so evil?
In the asp.net world, web stuff, I think the update panel and ajax control toolkit is evil, and refuse to use them.
|
|
|
|
|
Alright, I did copy this off the interwebs, sort of stuck on using the await to download a file.
I used the WebClient at first, and was able to use save as to save my file.
On this which actually waits and updates the progress, I think it works, I just can't figure out the save bytes part.
So I have this do loop, not sure if I need to save the buffer in chunks during the loop, or if the buffer has all my bytes, and just do 1 save at the end. The latter produces a bad file, it's missing pieces or something, not complete.
Dim desktop_Save As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\SqlLocalDB.msi"
Dim wc As Net.HttpWebRequest = DirectCast(Net.HttpWebRequest.Create(url), Net.HttpWebRequest)
wc.AllowAutoRedirect = True
Dim resp = Await (New TaskFactory(Of Net.WebResponse)).StartNew(AddressOf wc.GetResponse)
p.Value = 0
p.Maximum = CInt(resp.ContentLength)
Dim rqs = resp.GetResponseStream
Dim fs As New FileStream(desktop_Save, FileMode.Create) '// I should move this before write
Dim bufsize As Integer = 1 << 16
Dim buffer(bufsize) As Byte
Dim got As Integer = 0
Dim total As Integer = 0
Do
got = Await (New TaskFactory(Of Integer)).FromAsync _
(AddressOf rqs.BeginRead, AddressOf rqs.EndRead, buffer, 0, bufsize, Nothing)
total += got
Dim m_Bytes As String = _
"Downloading " & (Convert.ToDouble(total) / 1048576).ToString("0.00") & _
" MB" & " / " & (Convert.ToDouble(p.Maximum) / 1024 \ 1024).ToString("0.00") & " MB"
l.Text = m_Bytes
p.Increment(got)
Loop Until got = 0
fs.Write(buffer, 0, bufsize) '
fs.Close()
rqs.Close()
resp.Close()
|
|
|
|
|
With a fresh mind in the morning,
I had to write the buffer during the loop, and used bytes received as the count in the filesystem.write.
So now I get a clean write, and the file works correctly as well.
Dim bufferSize As Integer = 1 << 16
Dim buffer(bufferSize) As Byte
Dim bytesRecieved As Integer = 0
Dim bytesTotal As Integer = 0
Dim fs As New FileStream(desktop_Save, FileMode.Create)
Do
bytesRecieved = Await (New TaskFactory(Of Integer)).FromAsync(AddressOf rqs.BeginRead, _
AddressOf rqs.EndRead, buffer, 0, bufferSize, Nothing)
bytesTotal += bytesRecieved
fs.Write(buffer, 0, bytesRecieved)
Dim m_Bytes As String = "Downloading " & (Convert.ToDouble(bytesTotal) / 1048576).ToString("0.00") & " MB" & _
" / " & (Convert.ToDouble(pBar.Maximum) / 1024 \ 1024).ToString("0.00") & " MB"
pLabel.Text = m_Bytes
pBar.Increment(bytesRecieved)
Loop Until bytesRecieved = 0
If Not fs Is Nothing Then
fs.Close()
fs.Dispose()
End If
|
|
|
|
|
Hi Friends,
I need to calculate my tester's ideal time and generating a report through Visual Basic 6.0..
So, Select the MSflexgrid for better presentation..
I did fetching the file name and its created date from the defined directory to MSFlexgrid..
Now, i need to calculate the time gap between each and every file in another column of the MSFlexgrid..
So, Kindly help me on this regard as soon as possible..
Thanks,
Muraliraj
|
|
|
|
|
|
Hello !
I have a gridview bound to entity.
When I modify an existing value in a row , and after call Savechanges , everything is saved to database.
If I add a new row , or Delete an existing row from gridview , and after call savechanges , these changes are not saved to database.
What can I do ?
Thank you !
|
|
|
|
|
dilkonika wrote: What can I do ?
Debug your code. What else are you going to do?
Look at what you posted and think about what you supplied to us to help you solve this problem. NOTHING. We can't see your screen, your hard drive, see your code or read your mind. Hell, we don't even what kind of app this is! Is it Windows Forms? WPF? ASP.NET or MVC? or what?
Without seeing your code that loads the data and binds it to the grid and the code that saves it, it's impossible for anyone to tell you what you did wrong.
|
|
|
|
|
Hello !
I'm using VB.net 2013.
This is my code to load data in gridview :
Datagridview1.Datasource=(From t in context.orders select t).Tolist
Thank you !
|
|
|
|
|
...sigh....
You're not thinking. WHAT ELSE DO WE NEED TO SEE THAT MAY HAVE A PROBLEM WHEN YOU GO TO SAVE THE DATA??
|
|
|
|
|
I have this dialog, I just want it to stay inside the mdi parent and be centered.
But I get this error message, I don't understand the top level vs mdi parent part.
credDialog = New dialog_credentials(True)
credDialog.TopLevel = True
credDialog.MdiParent = Me
credDialog.StartPosition = FormStartPosition.Manual
credDialog.Left = (Me.Width - credDialog.Width) / 2
credDialog.Top = (Me.Height - credDialog.Height) / 2 - 100
If (credDialog.ShowDialog(Me) = DialogResult.OK) Then
Additional information: Form that is not a top-level form cannot be displayed as a modal dialog box. Remove the form from any parent form before calling showDialog.
I know it's straight forward, remove the mdiparent.
|
|
|
|
|
I'll just stick with a regular dialog, it works fine.
|
|
|
|
|
Why are you even using MDI?
Your code sample seems to say that you don't know what it was designed for and are trying to force it to do something it's not designed to do.
|
|
|
|
|
It was an option, so I took it.
But now I know better.
Not sure why it's there for a dialog.
I'll do some research tonight on it.
|
|
|
|
|