|
Ok, now that i have changed the locations of the _singlePointDialog.Show(RhUtil.RhinoApp.MainWnd) I see why i was doing this originally.
If i change the code so that when a user clicks a button it runs the code:
_singlePointDialog.Show(RhUtil.RhinoApp.MainWnd)
and
_singlePointDialog.Hide()
it shows the form but every call to _singlePointDialog.Show(RhUtil.RhinoApp.MainWnd)recalls Form.Load which resets all values that were previously set in the Form.Load call. That is why i was running:
_singlePointDialog = New singlePointDialog()<br />
_singlePointDialog.Show(RhUtil.RhinoApp.MainWnd)<br />
_singlePointDialog.Hide()<br />
to initialize the Form, and then using:
_singlePointDialog.Visible = True
and
_singlePointDialog.Visible = False
to show and hide the form.
Which brings me back to my original question is there a way to load the form(setting all important values) without visualizing it? This includes settings the form owner to RhUtil.RhinoApp.MainWnd which is an IWin32Window object.
I hope this clarifies my dilemma and someone has a clue how to solve it.
thanks in advance!
|
|
|
|
|
hey josh,
in your first post, you wrote the reason you want to do this, is for the form to receive data but to be hidden to the user until she wants to see it. i wonder what interesting problem you try to solve by this approach.
my suggestion is to collect the data in a collector-class. show the form when it is appropriate to the user and use the data from the collector-class then.
i really can't think of anything you need the form for to collect data. though i suspect you to "collect" keystrokes. are you? in case, there is a better solution to doing this.
regards,
arthur
|
|
|
|
|
Again an issue with the parent form-child form thing.
I have two forms Form1 and Form2.
Form1 is embedded as control in Form2.
Multiple instances of Form1,each with a different name are open in Form2.
I want to close all open instances of Form1 at the same time with the click of a button.
How should i start?
|
|
|
|
|
Loop through the controls of Form2, and check their type. if it is a form, close it. Shouldn't be harder then closing all types of control y within control x.
|
|
|
|
|
|
I have tried to search for an answer on line but maybe my search choices are worded wrong. I have a form that has multiple text boxes. (Just like many forms) I am using a barcode scanner to input data into the textboxes. I put a enter post amble in the scanner to go to the next field, and it works. The form gives the user the ability to lock fields and keep those values in the textboxes for multiple iterations of the form entry. I lock textfields by changing enabled to false.
Issue: When I scan the text box previous to a locked textbox the cursor will not tab over the locked field. I do not want to put a tab in the scanner do to other issues on that page.
I want to know if there is a way to force a tab through code. Example: When the textbox is validated then force tab to tab to next unlocked textbox.
Thank you for any help you offer.
|
|
|
|
|
Check that your locked control has TabStop property set to false. That could be the reason if the focus goes to the locked control.
Also since you now the layout of your form, one way could be that you programmatically use SetFocus method on the control where you want to go.
|
|
|
|
|
I have tried the tabstop idea. It still does not work. I Need to know if there is a way to force a tab in code. If I can I think it will work. I want to try that before I write a bunch of code to change focus.
|
|
|
|
|
You can simulate tab with SendKeys, but I think it would be easier to call for example: Select Method[^].
When you say that it doesn't work, do you mean that the focus goes to the locked control even though it's TabStop is False or does tho focus go somewhere else?
|
|
|
|
|
It sounds like there is no set tab order, that you are figuring out at runtime.
I use this to enable/disable our controls tabstops,
''' <summary>
''' This sets the tab stops to false when in inquire mode and tab stops to true if in update mode.
''' </summary>
''' <param name="c">C is the control from the calling form</param>
''' <param name="bStatus">This sets the control tabstops to True (enabled) false (disabled)</param>
''' <remarks></remarks>
Public Sub sInitializeControls(ByVal c As Control, ByVal bStatus As Boolean)
'This routine needs to be ran after a form is loaded
'When we enable and disable controls the cursor will stop on the controls that have been disabled
'This is a recursive function
'c = Control from Calling form
'
Dim ctrl As Control
For Each ctrl In c.Controls
If String.Compare(ctrl.Name, "btnClose") = 0 Or String.Compare(ctrl.Name, "btnCancel") = 0 Then
'exit
Else
ctrl.TabStop = bStatus
If ctrl.HasChildren Then
sInitializeControls(ctrl, bStatus)
End If
End If
Next
End Sub
You might be able to modify this to your needs.
I would think you could call this to set all tab stops false and then in the validation routine you could set the specific control you are wanting to move to
like so
control.tabstop = true
control.focus() or control.select()I have found the latter of these two to be more reliable
Humble Programmer
|
|
|
|
|
I have tried changing the tab stop with no luck. So, are you saying there is no way to force a tab through code?
|
|
|
|
|
does the gotfocus/enter routine fire if you hit tab? if so, test if the control is disabled and then issue a
My.Computer.Keyboard.SendKeys("{TAB}")
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
Take a look at the Control.SelectNextControl method. It may be what you want.
Alan.
|
|
|
|
|
This shouldn't even be an issue. How I did it in the past is enable the Form's KeyPreview, then handle it's KeyDown event. This handler should look for the preamble keysequence, eat the keys so they don't go to the controls, then start reading each key and appending to a string, until you see the postamble sequence, being sure to eat those keys. Then you've got the barcode, having never input the thing into a TextBox.
|
|
|
|
|
Hi I need a way to link upto 17 pivot tables so that when one pivot table's page (report fields) changes, all the other related ones change.
Has anyone any knowledge on how to do this?
Thanks
Paul
|
|
|
|
|
Hi!
I have a html table which is generated programatically. I need to send this table as an email I saw somewhere in internet that I need to use string builder to crop the text.could anyone please help?
<!--tablestarts--> -->is the starting text
<TABLE id="Table2" cellSpacing="0" cellPadding="4" runat="server">
<tr>
<td colSpan="5">Please confirm if your cart details are correct. Click "Order Now" to Order or else please press "Modify my Cart" to Modify your cart.</td>
</tr>
<TR >
<TD width="30%">Product Name:</TD>
<TD width="30%">Quantity:</TD>
<TD width="10%">UnitPrice:</TD>
<TD width="10%">Amount:</TD>
</TR>
</TABLE>
<!--tableends->--> ending
so i need to get the string in between those two and send as a email
how can i do that? a code hint will be really use ful.
|
|
|
|
|
uglyeyes wrote: so i need to get the string in between those two and send as a email
So, you have a string with much more in it because all you've shown is the table.
I'd probably use a Regular Expression to extract the table rather than use a StringBuilder. I don't think you can use a StringBuilder to find existing text, just manipulate the text.
|
|
|
|
|
how do i make following pseudo code work to fit my criteria
Mailmsg.body += regex.split(getAllCurrentPageContent, REGEX to get only strings starting from '<!--tablestarts-->' and ending at '<!--tablestarts-->')
in above could you please help as to how i get all the current pagecontent and appropriate regex?
when the email is sent will the table will render properly?
thanks in advance
|
|
|
|
|
The table will render properly if you send the mail as HTML. Not all clients support HTML though.
I are troll
|
|
|
|
|
I have already tried using
Table2.InnerHtml but i get not supported exception. now my only question is
also I have tried using below
Dim SB As New StringBuilder()
Dim SW As New StringWriter(SB)
Dim htmlTW As New HtmlTextWriter(SW)
Table2.RenderControl(htmlTW)
Dim tbl As String = SB.ToString()
MailMsg.Body += tbl
but this doesnt gives me the dynamically generated records.
how do i get currently rendered html content via aspx page(please note contents of Table2 is generated dynamically) and how do i use regex to only copy Table2's content.
please help
modified on Wednesday, January 7, 2009 11:13 AM
|
|
|
|
|
The examples below might help you;
http://dotnettricks.com/blogs/craigbowesblog/archive/2006/09/09/105.aspx
http://blogs.x2line.com/al/articles/859.aspx
--
What does it give you then? If the code runs correct, you should get the HTML as generated by "Table2". Does it?
I are troll
|
|
|
|
|
I have already tried what is mentioned in the article.
This only gives what is already in TAble2 before rendering Table2 programatically. here is what TAble2 has before its rendered programatically
<TABLE id="Table2" cellSpacing="0" cellPadding="4" runat="server">
<TR >
<TD width="30%">Product Name:</TD>
<TD width="30%">Quantity:</TD>
<TD width="10%">UnitPrice:</TD>
<TD width="10%">Amount:</TD>
</TR>
</TABLE>
the scripts mentioned in the article only gives me above but not the end result. i.e additional rows that are created programatically.
could someone please help?
|
|
|
|
|
sorry this works fine. I think the postback was causing the programatically created data not being loaded
I did this before I do postback
cache("data") = RenderControls(Table2) --> this comes from one of the links you provided me.
and it Mailmsg.body +=cache("data")
Thanks very much
|
|
|
|
|
Here is another idea. If your HTML is actually XHTML (basically HTML that complies with the stricter rules governing XML) then you could load it into an XDocument (if you have .NET 3.5) or XmlDocument (for any version of .NET) and extract it using XPath, or navigating to the appropriate node and performing InnerXml (or OuterXml ).
|
|
|
|
|