Selecting Word-Parts in C# - c#

While collecting some training data for NLP, I discovered that it is impossible to select parts of 2 adjacent words in a RichTextBox.
For example: you can not select "lect Me" from "Select Me" in a RichTextBox using mouse..!!
However it can be done using SHIFT key
Is there a property to be able to select parts of adjacent words not the whole words? That would make it easy for a human annotator...
Thanks

RichTextBox has a property AutoWordSelection. When you set it to false, you get what you need.
Most probably, you will need to do it programmatically - for some reason changing it to false in Properties Tab did not help.

Related

I need a multi-column control that only displays one column in c#

In my project I need a control that allows me to enter 2 columns.
First column is an Id Number
Second column is some Text.
Example...
row 1 Id = 1 Text = Day Shift
row 2 Id = 2 Text = Night Shift
But I only want to display the Text Values and then have the user select either Day Shift or Night Shift.
The program can then just lookup the corresponding value (1 or 2) for whatever text they chose.
- In Microsoft Access I would just have used a ComboBox and hidden the first column.
I cannot find anything in Visual Studio 2017 to put on my Windows Form that easily does this.
I want to set it all up at design time and the closest I have come so far is by using a LISTVIEW control using a display type of LIST (I don't want column headers either.
It seems to do what I want except that it always wants me to leave a blank space below my lines of text - presumably for a horizontal scrollbar even though I set it to False in the properties and it does not actually display a scroll bar.
If I resize the ListView control to just be big enough for my two rows of text it tries to display the 2nd row next to the 1st row and still leaves a blank space below the rows.
See the below images, assuming I uploaded them properly, I am totally new to asking questions here.
Is there a way I can achieve this - should I be using a different control?
The closest I came to what I need is the top image
[![enter image description here][1]][1]
Thanks and I hope it all makes sense.
In reply to Harry I added the below...
After adding the ListView control to my form I then clicked on the little arrow selector (in the top right of the ListView control).to bring up the collections list popup box.
It is there I set the view to be ‘List’ so I don’t have to have column header, then I clicked on EDIT ITEMS to get another pop-up screen…Click the [Add] button to add items in the rows.
Then I changed the Text to ‘Day Shift’ for the first member (and ‘Night Shift’ for the second member).
To add values in the rows for the 2nd column I then clicked the SUBITEMS (collection) box in properties to get the next popup…
I then clicked the Add button and created a new Text item (value 1)
and repeated this for the Night Shift member but gave it a value of 2.
These values are to be the actual ID values (in the 2nd column).
Note…
I did create column Headers but setting the View to List means I don’t get them displayed (and don’t want them displayed).
but I did notice that changing the View to List also removes the second column (Id) from the ListView display.
As I don’t need the Id values (1 & 2) displayed I am not going to worry about what happened to them disappearing in the display. All I did, though, was just changed the View from Details to List.
Sorry If I’m misunderstanding you but at this point there is no actual code I am creating, no doubt Visual Studio 2017 does that itself but I am not looking at that. Is that what you needed to see?
Hope this makes better sense though, I did try and include images but the system will not let me do that until my reputation points are higher, sorry.
Thanks

how to identify the first, second and third element when the object names are the same in CodedUI tests

I am writing CodedUI tests for a web application. There are three text boxes with the same name and I would like to know how do we call these text boxes ? Please advise ?
Use this:
var control = new HtmlControl(parent)
control.SearchProperties.Add([Control Type], [Control Name]);
var specificControl = control.FindMatchingControls()[index]
In the above code, what it does is find the three controls you mentioned with the same name, and then index them in a collection. By taking a piece of that collection with "[index]", you can isolate a single control.
This is what it looks like in practice in a WPF app:
//Identify the cell and minimize button 2017
WpfCell currentyearCell = new WpfCell(workWindow);
currentyearCell.SearchProperties.Add(WpfCell.PropertyNames.Value, DateTime.Now.AddYears(0).ToString("yyyy"));
currentyearCell = currentyearCell.FindMatchingControls()[0] as WpfCell;
If 3 elements has same property and if you will provide a search properties
Control.searchproperties.add("","")
And you intend to select 2 element.Than by this approach it will automatically identify the first element.
Just go for next sibling search configuration.
So it will go the next element or we can use children element[pass the index]

How to toggle (Expand/Collapse) group data in rdlc

In my rdlc report,I want to show my group data just like this example--
When I click (+) sign group data under the name will expand and When I click (-) sign group data under the name will collapse.I find resources for SSRS report, but nothing useful for rdlc report in recent times.So I followed in my rdlc according to those SSRC report resources if i can get some result.I followed this two specially--
SQL Server Reporting Services(SSRS)
Expand or Collapse All Grouped Items on SSRS Report
I took a table.take "GROUP2" as row details.add group parent "GROUP1" for "GROUP2".Like---
I select group properties for "GROUP2" like--
then i set visibility hide for "GROUP2" , checked "display can be toggled by this group item" and select "GROUP1" as item.like--
It gives me report like this--
there is "GROUP1" item visible, "GROUP2" is hidden but no (+) or (-) sign or button to expand or collapse group data.
Any one have any idea,What i am missing? or how can i do this in rdlc report like the top example of this question and also i want to set button for "Expand All" and "Collapse All" for this report.
EDIT: I am using asp.net mvc, web api-2 controller.I am tring to get report in pdf format.
First you need to select your column/row group and select group properties.
And then select the grouping item from your DataSource
There you go:
Before expanding of group
After expanding of group
First select the table cell showing [GROUP1], and in the Text Box Properties note the Name. This is not necessarily GROUP1, it could well be Textbox10 etc.
Then in the Text Box Properties for the table cell showing [GROUP2], select that Text Box name below "Display can be toggled by this report item:".
BTW you are likely wasting your time trying to use the expand/collapse functionality in SSRS. It is generally considered flaky and unreliable, and does not scale.
PDF format does not support toggling.
Ref:
https://msdn.microsoft.com/en-us/library/dd255288.aspx
(section titled: Toggle items within a report)
"PDF - The report server exports the current show or hide state of the report to PDF. Interactive toggling is not supported"
#MohammadSadiqurRahman Not sure if you got this problem solved but this is something I do that I hope may help you out.
You will need to make sure that your row groupings have been applied correctly. In the example you gave at the top of your post the row group parent would have been set to account type. You would need to make sure this is done for your 'GROUP1'.
Once you have done this set the row visibility for your collapsed row to 'Hide'. Now check the checkbox 'Display can be toggled by this report item' and set the report item to the cell name for the grouped account types.
Personally I attach it to a new label outside of the tablix which will allow for the entire table to expand/collapse with one click. Just depends on how you want it to work.
I hope this helps you out.

How do I search for different data types in a lightswitch editable grid?

I have a custom search textbox that searches for strings inside the grid. But I want the user to be able to search for dates and decimals as well from the same search textbox. Is this possible on the desktop application?
The "Search" functionality will only search on "strings" data types. It will NOT search on Dates or decimals, etc.
.
The best thing I could think of here would be to basically build your own Search button that is really just an input field to a Custom RIA Service, and that RIA Service would do all the "querying" you need.
Let me know if that helps or not.
THX - Matt
This will only work with List and Tile List screens not Tables..
and also only search the active pages if +- 300 records turn Page count off it still runs fast.
Add Standard Search method to the the command bar
optionally make it invisible, (I prefer that)
add this to the post render for the j20Resources table List display
myapp.BrowseResources.j20Resources_postRender = function (element, contentItem) {
// Write code here.
$(element).find("input").attr("value", contentItem.screen.j20Resources.search);
var $element = $(element);
var unorderedList = $($("ul", $element)[0])
unorderedList.attr("data-filter", "true");
unorderedList.attr("data-filter-placeholder", "search ...");
unorderedList.on("listviewcreate", function (event, ui) {
//we'll see if we can use this
});
};
Search box will always show half line (cant find a way to fix that)
click in box and enter 2 or more characters to search the live dom - that means anything and see the magic.
I wish the Standard Search box could work like this.

How to get values from dynamically created elements using jquery in code behind

Hi and thanks for taking the time to asnwer my question.
I have the following problem. I have a form and a button which says "add new activities".
Whenever the button is clicked I add a new set of elements, namely 2 drop down menus + text area. How can I get the values of these newly created elements in code behind since I cannot know their ids up front?
If there is something unclear about my question, please let me know.
Thanks again!
But you must be setting id's (more importantly - name attributes) of new elements using certain pattern. Use the same pattern in a loop in server-side code to get values from Request.Form. Provide a hidden input where you put the total count of items added for the server-side to know the upper bound of loop counter.
You should set the ids when you create the elements if you plan to access them again
So if you this is your text area:
var textarea = document.createElement('textarea');
You can set the id to like this:
textarea.id = "taId";

Categories