Lightswitch - add/edit window - remove created by, etc - c#

When you click on the add button in a lightswitch application, the default pop-up window will appear. Is there any way how to remove the by-default generated "Created","Created by", "Modified", "Modified By" lines? (Other than creating a custom add details window).
I am talking about these ones:
I have found this link here where the person says something about the metadata. Is it the right way to go? If yes, how do I access the metadata and where exactly do I put that code?
I am using Visual Studio 2013 and doing the app in C#.
Thanks in advance.

For anyone who would be stuck with this as well in the future - you have to right-click on the table in the server part, select "open with" and select "Automatic Editor Selector (XML)". You have to then scroll to EntityProperty and add "" attribute to it, as described in the link I posted in the original question. Then save the XML and reload the project. This will hide these fields when adding a data to this table.
Make sure to back up your project before doing so in case something goes wrong.

Just wanted to let you know what worked for me. I just brought up the table in "Server" view, selected the boarder, then went over to the properties, and unchecked the box marked "Enable Created/Modified properties" under "General". Sorry if that didn't work, I'm very new to Lightswitch myself!

Related

Visual Studio 2022, Form refactoring and text boxes issue

I'm a very newb and know nothing about any IDEs, I've encountered a problem where if I change "Form1" to any other name with proper refactoring it won't add any textBox in the solution explorer, I will see the textbox in the [Design] form but not in the code.
Can someone explain me how to rename things without Visual Studio losing total trace of objects ?
Eventually how can I insert objects manually via code, I know there is a solution but I don't know where find this code to generate an object.
enter image description here
I appreciate any help, not that I've started C# a couple weeks ago.
How you change the name of the form is important.
If you simply open the code file and change it's name in the .cs file, that's going to fail pretty quickly. A .designer.cs file sits behind the .cs file and contains all the controls, and it thinks the name of the form is Form1.
The best way to rename a form is to either:
Use the Visual Studio shortcut to open the Rename dialog. (For me, the shortcut is CTRL+R+R. For you, it may be F2.) Use the dialog to type in a new name and press enter. This will change the form's name everywhere it appears in the solution.
Right-click on the form in Solution Explorer. Select Rename from the menu that appears. Type in the new name for the file and press enter. When prompted to rename the type to match the file name, select Yes. This will also change the form's name everywhere it appears.
For Form name change:
Select Form Design
Press F4 (Properties of Form)
Form's Properties will open
Goto Form Name Option
Change the Name and press enter
Your form name gets changed successfully.
Open Form.Designer.cs for codeing of the designing part.

Change find all / search all result interface in Visual Studio 2019 community

i dont like the new interface of my search all, it suddenly change when i reinstall my visual studio
here is my search all result interface
the result suppose like this
Do you guys know how to change the result interface ?
It sounds like you are using 2 different types of search.
The first capture you provide is from Find and replace feature, that cand be raised with shortcut Ctlr + F, and when you select option "Find all". It returns a lsit fo files that match the text you are searching for. You may check Microsoft documentacion for Find and replace
The second capture represent the usage of Find references in your code, that provides a way to find where particular code elements are referenced throughout your codebase. You can find more information in Microsoft documentacion for Find references.
If you want to make use of Find references feature, you should use shortcut Shift + F12 or simply you can make right click over any object/class/element in your code, and select option Find all references.
Capture: Find all references using right click and contextual menu
Remember that this would not work with a simple piece of text, you must find references of an existant element, like a model, a class, a variable, etc.
Hope this info could be useful.
[EDIT]
Maybe I could misunderstand your question. If you refer to the theme (backgroud anf font color mainly) of the interface, you could set Light theme option, through main menu, selecting Tools menu, and then Options. once there, enter section General, under Environment option, and select Light option in dropdownlist associated with Color theme option.
Check this link (made for VS CE 2017, but work as well) to see captures of the process:
https://ourcodeworld.com/articles/read/869/how-to-change-to-a-dark-theme-in-visual-studio-community-2017
[EDIT FOR COMMENT]
I've checked it with VS 2019. As you said, default view for Find all feature looks like references result view. If you want to keep the "classic" list view, you can simply click on ListView button, at the right top, on the bar that appears over your result section, as you can see in following capture.

User not required to fill out required fields?

So I got a document library that I made using the Wizard found in Visual Studio 2013 Professional for Sharepoint 2010.
After creating the list I go and add 3 new fields that I need and set them all to required. However when I go look on my deployed Sharepoint site the fields don't show in the properties after I upload a document.
They don't even show if I go and press "Edit Properties" on the file. I am not sure what the problem is here. I didn't edit the Schema.xml and I made all fields using the visual editor.
This is deployed on a Farm Solution not a Sandbox.
I've had this problem on occation. Have you tried to make a new list instance based on your definition? When you create your List Definition with corresponding columns I belive that the Instance that gets created automaticly when you create the Definition is "empty"
I think this resource might be of help: https://msdn.microsoft.com/en-us/library/office/ff728096%28v=office.14%29.aspx
Good Luck! //Kodz

Interacting with OleObjects/embeded controls VSTO, VBA Conversion

I'm working on converting an old VBA project into a C# VSTO. I know a lot of the code has to go out of the window, but I was hoping to still use the layout and objects that had been embeded into the sheet. Examples of the objects include controlbuttons, labels, images, etc.
All of these persist nicely when I choose the document as a template when making a new project. I run into the problem in that I can't seem to select or reference any of these objects. For example there's a button in the middle of a sheet. If I open the sheet in VS2012, I can see the button. I can even "highlight" it but not select it. If I right-click on the button to pull up the properties, it will bring up the properties for the sheet, not the button. I can't resize them or move them around (not that I want to).
I also can't seem to reference them in code, ie ...Sheet1.ControlButton1... or ...Sheet1.OleObject(n)... will never refer to anything. If I open up the workbook directly from the solution folder and click on the same control I can see properties, and the formula bar in Excel reads =EMBED("Forms.CommandButton.1","").
I've also not been able to loop through all the OleObjects and just display their names. Clearly where ever the collection is that is storing these I can't find it.
Try the Workbook.Shapes collection
Edited as per the comments below. This works:
Globals.ThisWorkbook.Worksheets(1).OLEObjects("CommandButton1");

How do I fix these C# errors?

I found some code to help me in a project and when I first ran the code I received an error message indicating: "Visual Studio cannot start debugging because the debug target c:\path\'dirInfo.exe' is missing. Please build the project and retry, or set the OutPath and AssemblyName properties appropriately to point at the correct location for the target assembly."
Then I select OK and receive an error message indicating that partial is missing. I add partial to the code and receive 3 more error messages.
The type 'RecursiveSearchCS.Form1' already contains a definition for 'components'
does this mean I should delete this from the Form1.cs file?
Type 'RecursiveSearchCS.Form1' already defines a member called 'Dispose' with the same parameter types.
Type 'RecursiveSearchCS.Form1' already defines a member called 'InitializeComponent' with the same parameter types.
(I notice, when I comment out the InitializeComponent line and/or Dispose line, many more error messages populate in ERRORS)
By they way you can find the original code # MicrosoftSite.
Any help would be greatly appreciated.
Thank You
Just gut instinct, if you were following along and copy pasting remember one key thing:
The designer creates two files when you create a form: A "code" file, and a "designer" file. However, when microsoft (and others) release "templates", they like to merge these two files.
Just create a new .cs file and paste the code and all should be good. It's the code basically saying "in the designer, we already have this stuff". (a good way to note this is the "partial" keyword located before your Form1 declaration)
More info:
The Code file will house all your own implementations. That is click events, methods you personally override, events you bind to, etc. This is the default file when you select "View Code" from either your solution explorer or the dialog itself. Within this file is a construct that calls a "hidden" method, (InitializeComponent) that if you right click and "Go to Definition" will bring you to the next file:
The Designer file is the IDE's generated file. This takes everything you do in the designer and stores it for you. That includes new controls, location and properties of the controls, and the IDisposable implementation. The idea is to keep the "meat an potatoes" out of the way while you worry only about implementation.
Yes it sounds like you've copied the entire code which includes many things already contained within your Form in a partial class. Either remove these or remove the partial class and partial class declaration from your Form to get rid of these errors
I went to the Microsoft site to see what you did. The site shows code for an entire "one file" solution. We've all agreed that Visual Studio creates multi-file solutions, so you're duplicating code.
I don't know if the current answers/comments have helped you get this sample code working, so I thought I'd add my share. I was able to get this sample working by doing the following:
First, where the sample code at the Microsoft site shows declarations for button, textbox, labels, and combobox, rather than attempting to copy that portion, I simply used the toolbox and dragged a button, the labels, the textbox, and the combobox from the toolbox to my form.
You'll probably want to arrange these to your liking.
This process created my form correctly with the appropriate objects on it. All I had to do was use the properties window for each object and rename them according to what they were named in the sample. For example, my new button was originally button1, but I renamed it to btnSearch just as it is named in the Microsoft sample.
I noticed that the Microsoft sample has an established event handler setup for the Form1_load() event. I created this same event in my form by clicking the form in the designer, clicking properties, clicking on the Events button in that properties, and double-clicking the "Load" event. This automatically generated the appropriate code.
In a similar way, I had to create the btnSearch_Click() event. I did this by simply double-clicking the button in the designer.
After that, all I had to do was manually copy and paste from the specific sections of the sample to my code -- fill in the Form1_Load() event with what was in the sample. Copy the DirSearch() method over. Fill in the btnSearch_Click() event. That was it.
I hope this helps solve the overall issue and gives you more insight into how you can avoid these problems in the future.
You have duplicated functionality in the classes, you have a file that was automatically generated with that functionality already in it.

Categories

Resources