|
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.
|
|
|
|
|
Because a Dialog is nothing but a specialized Form?
Seriously, why are you even using MDI?
|
|
|
|
|
I made a windows app that basically is a crawler for a friend. it crawls a dealer website and collect all the items, prices and stock.
The main window is a MDI parent.
The first form, MDI, is the main crawler that does the data acquisition. has a web browser
The 2nd form, MDI, allows you to work with the data collected. has a listview
I have 5 dialogs,
About
Progress
UserInfo
Preferences
Download LocalDB
Program Intialization.
In hindsight, I really don't need the first form, so I'm going to try and move the functionality to the main Form.
I'll admin, I'm not an expert in windows program design, but decent at it.
I remember now, I run the progress dialog with MDI parent, so I thought I could do the same.
When I ran the UserInfo dialog with MDI parent, I wasn't able to get the values from the textbox in the dialog.
I don't have an answer to the question
|
|
|
|
|
OK, MDI stands for Multiple Document Inteface.
Imagine have a child window that is a Notepad like text editor. The MDI interface was designed to have multiple copies of that child window in the MdiClient area of the parent form, allowing you to edit multiple files at the same time.
MDI is an outdated concept that Microsoft doesn't even support/use any more.
What you're describing about your app doesn't lend itself to MDI at all, and frankly, I think hinders your UI by using it.
|
|
|
|
|
Just change the forms to non MDI?
And then work on the UI and make it more modern?
|
|
|
|
|
|
OK, I think I get it now.
I have a question
Take Microsoft Work 2013 for instance, that latest one.
The program opens, and you get that no window looking thing, you pick a task, and you get
something that resembles a window.
Click file, and you get that smooth look again.
What is that smooth look?
Is it a panel?, or like a smooth look object?
Seriously, I have some good ideas now for a UI.
|
|
|
|
|
I have no idea what you're talking about and I staring at Word 2013.
|
|
|
|
|
i should of taken a picture of it or something.
Anyways, you motivated me to make a huge UI change or upgrade, and I'm very pleased with how it looks and operates now. WOW what a difference.
I tried using just panels for different layouts, and dock filling them when needed.
But ended up going back to the
frm_Main - MDI Parent Container
frm_View - MDI CHild
frm_Aquire - MDI Child
The rest is just dialogs.
I really don't need the child windows, I just need display containers that go full dock inside the parent window, but I have no clue how to go about it.
This is only my 3rd windows app in the last 4 years. So my UI and design knowledge is really out dated. I can write the code very well for function, but my UI program design is very 1996, which is when I wrote my last production windows app.
I have to get this project out this week, as a prototype for a future project next year.
But I will go back and remove each child window in the project after submitting the prototype.
|
|
|
|
|
Change your main form, remove the MDI parent.
In your new main form create 4 panels, top, bottom, left and right. Dock them to their edges and either left or right dock to fill. This forms your basic layout.
Copy the content of your MDI forms and paste into the left/right panels. Chuck your MDI forms away (after moving the code as well of course).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Oh, so I was on the right track.
They became hard to manage for me, but they did display correctly using the panel method.
Where do you put the code for the panels, that part was vague to me. I wanted to keep the code organized with the panels.
That's why I reverted back to the MDI forms for now.
|
|
|
|
|
It all lives in the code behind the form or where you decide to organise it. I make heavy use of #regions to make navigating the code easier.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
We have a VB.Net 2010 Windows Desktop app that creates custom invoices for QuickBooks. The app uses the Microsoft.Office.Interop.Word reference.
For each item in the invoice we copy a row or table in Word via
MyTableRowRange.Copy()
and
pRow.Range.Paste()
etc.
Then
Word.Find.Execute(Replace... to change the variables in a Template.Docx file to the real values.
The problem is that it takes too long. Doing 2 invoices with a total of 200 items is taking over 30 minutes on a I3280 quad 3.6 with 8 threads and 16G ram. This is running from a regular exe not from the vs ide.
Any ideas?
|
|
|
|
|