|
Let us know what the outcome was. I've come across that error several times, and it's always tricky to resolve if you think you've done everything you need to. Another possible solution to add to my bag of solutions would be good to know about.
Simon
|
|
|
|
|
I neglected to post my results last Friday.
I compared the .sln, vbproj, and class files with WinMerge. There wasn't anything different between other than the platform target and names of the files. Dunno what was causing the problem.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I am using WebRequest class to crawl a sites.
This class is just working like a browser.
It takes more time to download the response.
Is there any idea to download only the Response Text so quickly Using .NET?
Thanks,
Nagaraj
|
|
|
|
|
Nagaraj Muthuchamy wrote: This class is just working like a browser.
In what way is it acting like a browser? Is it running the javascript on a page or something?
Nagaraj Muthuchamy wrote: It takes more time to download the response
More time than what?
Nagaraj Muthuchamy wrote: Is there any idea to download only the Response Text so quickly Using .NET?
I don't see how. It is just an HTTP wrapper around sockets. It doesn't really do that much for you. You still have to interpret the response yourself.
|
|
|
|
|
Hi, I want to implement redo - undo functionality in my winforms application developed in vb.net
Please guide
|
|
|
|
|
Think about the scope of the undo (before/after commit of data to the database)
Decide how you are going to deal with rolling back any changes in the data
Implement in code your design decisions.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You may also want to do some reasearch into the Command pattern.
|
|
|
|
|
Hi I have one Plan try it!!!!
Use one more datagrid(2) control make that visible=false then
What ever changes u made in original datagrid control store in that 2nd one cell data in one cell. next cell address like { Row * Column) (Vice verse for undo and redo) When the user will call the undo or redo operation call that values in stack method...
may be it will help for u...
|
|
|
|
|
|
lol
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I just finished off implementing a custom undo redo feature for a similar problem, what I did was create 4 classes. The first class is your UndoRedoManager class which will manage your undo/redo commands. Next we have our topmost class titled UndoRedoList which has 2 Collections. An Undo collection and a Redo collection. Then we have our middle class which has also a collection of what I needed was titled ChangesSet, since in my application we treated a series of cell changes as a single change. Last class is a change, where you record the cell location, the before value and the after value.
So on every cell change, you create a single ChangesSet object, and as many Change objects as you need (for each cell changed) and you store it in the ChangeSet collection, as a single entry in the UndoRedoList collection. for each undo command issued, move the ChangesSet object out of the Undo list into the Redo list.
Hard to explain, I can't provide the source but I will show you when I get home with some sample code based off of a datagridview. But, if you understand my broken logic above, you should be well on your way.
Just realized I forgot to say, if your datagridview cell being edited doesn't effect other cells, you obviously wouldn't need the second ChangesSet class, you would just need to create Change objects inside a Collection so you can cycle through it as you need to.
modified on Friday, December 12, 2008 1:22 PM
|
|
|
|
|
Hi to all,
I'm using VS2008 and VB lang.
How do I reference a method in the usercontrols parent container.
I'm coding, or at least trying, controls that constitute a Windows Control library that facilitates standardized size colour fonts etc.
the Library contains hierarchies of inherited classes e.g basebtn->OKBtn, basebtn->OKbtn->OKBlueBtn, basbtn->savebtn , basebtn->savebtn->savedeletebtn. etc.
Somewhat obviously at design time these classes do not know their eventual parent.
The parent will have the method being called
A simple example would be a Save button.
The form would have a SaveAll method
The buttons click event would call the forms SaveAll method.
Thanks in advance for anyone spending their time helping me out
|
|
|
|
|
You add the method as the onclick event of the button - google ADDHANDLER
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks Bob.
I've made the first pass using your suggested google - ADDHANDLER but I'm not able to derive a solution at the moment. All the examples I've seen so far use a button on a form.
Although my classes will eventually be on a form I'm coding in a library that has no knowledge of a form. The class library only contains my inherited controls though eventually the library will be added to each solution that uses my library.
Nonetheless I'll keep looking -
Thanks for the input.
|
|
|
|
|
You should never call a method on the parent form of a usercontrol.
Instead add an event to your usercontrol
In the clickevent of your button you raise this custom event.
Then on the parent form you can simple catch the event you created and excecute the code you want.
|
|
|
|
|
Hi Tom,
Thanks for the reply. I'm confused though. I obviously have not had dealings with events and event capture.
Can you point me to some article or give an example on how the form makes itself aware of an event.
Also to mention I'm not just sitting back waiting to be spoonfed - I'll be googling this as well as Bobs ADDHANDLER.
Thanks for the speedy response by the way.
|
|
|
|
|
simple example:
<br />
public class MyButton<br />
private event MyButtonClick<br />
private withevents btn as button<br />
public sub new<br />
btn = new button<br />
btn.text="test"<br />
me.controls.add(btn)<br />
end sub<br />
<br />
private sub btn_click (sender as object,e as eventargs) handles btn.click<br />
raiseevent mybuttonclick<br />
end sub<br />
end class<br />
<br />
public class MyForm<br />
private withevents mybtn as MyButton<br />
public sub new<br />
mybtn = new mybutton<br />
end sub<br />
<br />
private sub mybtn_mybuttonclick() handles mybtn.mybuttonclick<br />
'Do your code here <br />
end sub<br />
end class<br />
This is all from memory so you might have to adjust a bit.
Your control doens't know and shouldn't know about the form.
Its the form that handles your control's mybuttonclick event
|
|
|
|
|
Thanks Tom.
I'll put this code into a test and modify it if required.
Tom Deketelaere wrote: Its the form that handles your control's mybuttonclick event
This is understood.
I am attempting to avoid having to write the button click handling code into each form. In my scenario the form would be subclassed and reside in a library that would be added to the solution. This subclassed form in the library would be pre-sized and formatted to maintain a consistent UI. It would have code that handles the control(s) say the click event. That code would only be called if the production form had an instance of that/those particular control(s) and a triggering event occurred in the control. Hence my thinking that the control would call up to its container. The control would not know or care about its parent, it would only know that it needs to call its parent when its trigger event occurs. The parent, admittedly more often than not a form, would assume control of any subsequent actions, including chaining up to its parent if necessary.
I think that we have now exhausted this thread.
Thanks for the response.
|
|
|
|
|
Valkiri wrote: How do I reference a method in the usercontrols parent container
You should never be doing this. A control should not care about, nor try to explicitly manipulate, it's parent container.
Valkiri wrote: Somewhat obviously at design time these classes do not know their eventual parent.
The same is true for runtime. Your controls should not know anything about their parent.
Valkiri wrote: The buttons click event would call the forms SaveAll method.
No, it shouldn't. Your control shouldn't even have a button like this. This button should be on the parent form, not your control. Your control only needs to expose, by public properties or events and argument, the values and settings under its control. It's up to the parent form to decide what to do with those values.
|
|
|
|
|
Hi Dave,
Thanks for your response.
I think that my terminology may have misdirected you. I'm trying to say that a button is a control and the button would be on a form but it may also be on a context strip for instance or part of another control.
The control be it a button or any other type of control needs in my scenario, to communicate with procedures and or functions in the form. The control - the button does not know anything about how to, what to, or where to save for instance. All it knows is that some event e.g. Click has taken place.
If I have 20 forms I don't think that I need to write the same code into the 20 buttons on the form. I believe that I should be able to have a library of buttons that have been specialized that call the parent form parentform.SaveALL to save parentForm.DeleteALL to delete, parentform.ChangeFBackground("Blue") to change the forms background etc.
Once the library has been added to my project I should be able to drag and drop the buttons for instance onto the form.
My problem is how to code a reference to the form when the form has not even been created yet. It will be at runtime of course.
However I am pursuing the event handler approach but at this point in time I am still confused. If you have any pointers to URLs or Code I'll be happy to look 'em up.
Thanks again - I am trying to grasp this.
|
|
|
|
|
My statement still stands. The control does not need to know about 20 instances of a form. This is, again, a job for the containing form, not your control.
Valkiri wrote: I believe that I should be able to have a library of buttons that have been specialized that call the parent form parentform.SaveALL to save parentForm.DeleteALL to delete, parentform.ChangeFBackground("Blue") to change the forms background etc.
Wrong. This is a bad method to use and actually has you generate more code than is necessary. The code on the form should SOLELY be responsible for it's appearance and actions. The controls should NEVER have any clue that they are even sitting on a form.
Valkiri wrote: My problem is how to code a reference to the form when the form has not even been created yet
You cannot have a reference to an obejct that does not exist. The closest approximation to this is an Interface. If you use your proposed control library on a form, that form will have to implement a known Interface to be able to have the controls call it. But, again, this is NOT a good idea because the form must now implement an interface ahead of time, specifically to use your controls.
|
|
|
|
|
Look what I've Found:
http://www.codeproject.com/KB/cs/agusercontrol.aspx[^]
This appears to address what I had in mind except in my case the I would want the button control to be in a separate library that would be added to any solution created and then dropped onto my form which is held in another library.
Are you stating that controls should never (hardly ever anyway) call the form.
Am I correct in understanding that you advise that the form should listen for and catch the, say, click event and act upon it.
If the above 2 statements are true I really need to reassess my understanding of the concepts - go away and do some serious reading.
If the form is waiting to catch the event does this mean that the controls say click event has no code in it.
Do you know of URLs / articles that address this question of using control libraries. ALL examples that I have access to drag and drop controls from VB's standard toolbox.
If I appear dogmattic it's only because I have a desire to understand - apologies and thanks for your responses and patience
|
|
|
|
|
Valkiri wrote: Look what I've Found:
http://www.codeproject.com/KB/cs/agusercontrol.aspx[^]
Just because there's an article on the subject, doesn't make it a good idea.
Valkiri wrote: Are you stating that controls should never (hardly ever anyway) call the form.
It goes against OOP practices, specifically, "encapsulation", yes.
Valkiri wrote: Am I correct in understanding that you advise that the form should listen for and catch the, say, click event and act upon it.
That's one possible solution, yes.
Valkiri wrote: If the form is waiting to catch the event does this mean that the controls say click event has no code in it.
It should have the code necessary to clean up the data the control, and that button, is responsible for and raise it's event or some other notification mechanism.
Valkiri wrote: Do you know of URLs / articles that address this question of using control libraries.
I haven't found much in the way of control development on the web. Mostly in books and from what I gleaned out of the .NET Framework itself, using Reflector.
|
|
|
|
|
Hi Dave,
Many thanks for your input. I'm now off to reassess my approach spurred on by your comments.
Naturally I've got more questions but I do realise this is not a one to one tutorial.
So consider this thread as complete.
If I come up against another brick wall this is where I'll post my query.
Once again I stress that I appreciate you taking the time (again and again) to attempt to pull me back on track.
Have a nice one and the Seasons Greetings.
|
|
|
|
|
Hi,
I am facing this error for the following code. please reply and do the needful
Private Sub Command0_Click()
Dim DbAdo As ADODB.Connection
Dim RsAdo As ADODB.Recordset
Set DbAdo = CurrentProject.Connection
Set RsAdo = New ADODB.Recordset
Dim stDocName As String
Dim stDocName1 As String
Dim stDocName2 As String
Dim stDocName3 As String
Dim i, j As Integer
Dim str1 As String
Dim K As Integer
stDocName = "Personal"
RsAdo.Open stDocName, DbAdo, adOpenStatic, adLockPessimistic
Dim createExcel As New excel.Application
Dim Wbook As excel.Workbook
Dim Wsheet As excel.Worksheet
Set Wbook = createExcel.Workbooks.Add
Set Wsheet = Wbook.Worksheets("Sheet1")
Wsheet.Name = "Test"
i = 0
j = 0
'Wsheet.Cells(1, 1) = "Hosp ID : " & Me.HCO
'Wsheet.Cells(2, 1) = "Process : " & Me.ThisPdProcNum
'Wsheet.Cells(3, 1) = "Processing Period : " & Me.ThisPdStartDate & " - " & Me.ThisPdStopDate
'Wsheet.Cells(1, 1).Font.Bold = True
'Wsheet.Cells(2, 1).Font.Bold = True
'Wsheet.Cells(3, 1).Font.Bold = True
'Wsheet.Cells(5, 1) = "GL Research"
'Wsheet.Cells(8, 1) = "Unmapped Cost Centres"
'Wsheet.Cells(5, 1).Font.Bold = True
'Wsheet.Cells(5, 1).Font.Size = "20"
'Wsheet.Cells(8, 1).Font.Bold = True
'Wsheet.Cells(1, 1).EntireColumn.ColumnWidth = "10"
'Wsheet.Range("A:IV").Interior.ColorIndex = 2
'Wsheet.Range("A:IV").Interior.Pattern = xlSolid
'Wsheet.Range("A:IV").Interior.PatternColorIndex = xlAutomatic
For i = 0 To RsAdo.Fields.Count - 1
With Wsheet.Cells(9, i + 1)
.Font.Size = "9"
.Font.Bold = True
.Interior.ColorIndex = 15
.EntireColumn.ColumnWidth = 15
.EntireColumn.AutoFit
.HorizontalAlignment = xlHAlignCenter
.Value = RsAdo.Fields(i).Name
End With
Next i
If (RsAdo.RecordCount > 0) Then
RsAdo.MoveFirst
cnt = 10
Do Until RsAdo.EOF
Wsheet.Range("A" & Trim(Str(cnt))).Value = RsAdo("sno")
Wsheet.Range("B" & Trim(Str(cnt))).Value = RsAdo("name")
Wsheet.Range("C" & Trim(Str(cnt))).Value = RsAdo("age")
'Wsheet.Range("D" & Trim(Str(cnt))).Value = RsAdo("CCDESCR")
'Wsheet.Range("H" & Trim(Str(cnt))).Value = RsAdo("On CC RD XREF")
'Wsheet.Range("I" & Trim(Str(cnt))).Value = RsAdo("On New Base")
'Wsheet.Range("J" & Trim(Str(cnt))).Value = RsAdo("On New Fin")
RsAdo.MoveNext
Wsheet.Range("A" & Trim(Str(cnt))).Borders.LineStyle = xlContinuous
Wsheet.Range("B" & Trim(Str(cnt))).Borders.LineStyle = xlContinuous
Wsheet.Range("C" & Trim(Str(cnt))).Borders.LineStyle = xlContinuous
'Wsheet.Range("D" & Trim(Str(cnt))).Borders.LineStyle = xlContinuous
'Wsheet.Range("E" & Trim(Str(cnt))).Borders.LineStyle = xlContinuous
'Wsheet.Range("F" & Trim(Str(cnt))).Borders.LineStyle = xlContinuous
'Wsheet.Range("G" & Trim(Str(cnt))).Borders.LineStyle = xlContinuous
Wsheet.Range("A" & Trim(Str(cnt))).Font.Size = "9"
Wsheet.Range("B" & Trim(Str(cnt))).Font.Size = "9"
Wsheet.Range("C" & Trim(Str(cnt))).Font.Size = "9"
'Wsheet.Range("D" & Trim(Str(cnt))).Font.Size = "9"
'Wsheet.Range("E" & Trim(Str(cnt))).Font.Size = "9"
'Wsheet.Range("F" & Trim(Str(cnt))).Font.Size = "9"
'Wsheet.Range("G" & Trim(Str(cnt))).Font.Size = "9"
'Wsheet.Range("D" & Trim(Str(cnt))).Interior.ColorIndex = 35
'Wsheet.Range("E" & Trim(Str(cnt))).Interior.ColorIndex = 35
'Wsheet.Range("F" & Trim(Str(cnt))).Interior.ColorIndex = 35
'Wsheet.Range("G" & Trim(Str(cnt))).Interior.ColorIndex = 35
'Wsheet.Range("D" & Trim(Str(cnt))).NumberFormat = "@"
'Wsheet.Range("E" & Trim(Str(cnt))).NumberFormat = "@"
'Wsheet.Range("F" & Trim(Str(cnt))).NumberFormat = "@"
'Wsheet.Range("G" & Trim(Str(cnt))).NumberFormat = "@"
cnt = cnt + 1
Loop
RsAdo.MoveLast
Else
Wsheet.Cells(10, 1) = "None for this month"
Wsheet.Cells(10, 1).Font.Bold = True
Wsheet.Cells(10, 1).Font.ColorIndex = 5
End If
End Sub
With Regards,
Samson
|
|
|
|