Name not a valid identifier - vb.net

I am making a VB.NET Windows app, using DataGridView. I am trying to add and name my columns. I try to name the first column Step, and it gives me an error 'Step' is not a valid identifier. If I type Name it does not give me an error. Why can't I name this column Step?

Step is a VB keyword, so you can't use it as the name of a column because the designer will try to generate a field with that name. You should never encounter such an issue anyway, because Step is a bad name even if it was allowed. If someone was to see that name in code they would have no idea what it was actually for. At the very least, use StepColumn. You could certainly change the header text to "Step".

Related

Capitalized letters in method name after wrongly assigning colUMN variable

I wrongly assigned colUMN variable, then changed to colN but VBA has started to act all Column method with colUMN.
When I use intellisense it is written as Column, but when I press enter it goes back to colUMN.
It works as range.Column property fine.
I think I changed the property of VBA unwittingly. Will it be bad for my further code?
The VB Project Editor tries its best to keep capitalization consistent on each variable name that you type, but it does occasionally mess up. But its just that, capitalization, it doesn't actually mess up the code. Although it might be written colUMN, the Range object still only has a property called Column and when the code runs, it will properly give its Column value.

Cannot set default value of a field in an Access Table

I am trying to set a default value of a field in an access table in Table Design. The test I entered is:
=DLookUp([Tbl::VII::A::03::b_stkIden].[stkTersNam]","[Tbl::VII::A::03::b_stkIden]","[stkIdx]= [stkIdenOld]") where
In the different attempts the text was typed (did not work), copied and pasted (did not work). Keeps saying Default value or Validation rule is invalid.
stkIden is the source table containing the value I need
stkTersNam is the field which contains the value I need
stkIdx is the index field of my target table in which I want to insert the lookup value
stkIdenOld is the index field in the source table …stkIden.
It seems that default value attribute of tables in Access 2019 no longer accepts any references to any Table in the current database. It seems strange the Ms would remove this essential functionality. Is this just a quirk of the Jet Engine.
Please help. I am desperate. Should I consider abandoning Access for some other more user friendly database.
Should not have 'where' at end of expression. Don't put parameter within quote marks - concatenate dynamic parameter. Missing quote mark for the field argument.
=DLookUp("[stkTersNam]", "[Tbl::VII::A::03::b_stkIden]", "[stkIdx]=" & [stkIdenOld])
If stkIdx is a text field, use apostrophe delimiters.
=DLookUp("[stkTersNam]", "[Tbl::VII::A::03::b_stkIden]", "[stkIdx]='" & [stkIdenOld] & "'")
However, this won't work as a DefaultValue (won't in any version of Access) and really makes no sense to pull related info via DefaultValue property anyhow. Options:
Query joining tables.
Multi-column combobox on form.
DLookup in textbox ControlSource.

Data element description is not updated in SE16N

I changed the DataElement of one column in SE11 transaction.
When I open the table at SE16N, the column name is the description of the older DataElement.
How do I update the column with the new description?
Example:
At first time, I created as this:
FIELD DataElement Description when show at SE16N
COD_PANEL NUMC5 numc5
At second time, I alter the DataElement:
FIELD DataElement Description when show at SE16N
COD_PANEL ZCOD_PANEL numc5
If I open the table in other language, the new name it's correct.
The reason why it doesn't work is probably the language.
You have to change the values for every language separately.
Login with the language where you want to update and do the changes again.
Then it should work.
Otherwise, did you activate the changes?
You can use transaction code SE14 to adjust DDIC objects to changes
It updates all database attributes and their corresponding representation in DDIC.
I usually do the following steps:
Manually remove the old description that is displayed.
Deliberately enter a typo in the used DDIC element name. This will make the system show an error message since that element does not exist.
Correct the DDIC element spelling. The system now considers this a big enough change to pull in the correct description of the element.
Result: The description of the changed DDIC element is now shown.

Generate unique name everytime like "Windows folder structure" behaviour

I want to create folder structure logic like windows.I am using SQlite database for that. I want to generate a unique name everytime. For e.g. if user enters text with name "New". And if again he enter same name "New" then it should be New(1). if again he enter same name "New" then it should be "New(2)". If user delete "New(1)" entry and enter "New" then "New(1)" should be placed in between "New" and "New(2)".
Could anyone suggest logic for that? Any help is appreciated?
Thanks in advance
Tejas
I consider you will have a database with id and foldername as fields. You just need to retrieve all records from database. In where of query use like operator. Once you get list go in a loop and add add new entry by comparing number. Try this.
Here's the logic I use to do something similar in an app:
Declare an NSString called prefix and an NSInteger called number.
Check if your name has a number on the end of it:
If it does, set number to the value of that number and prefix to the name without the number.
If it does not, set number to 1 and prefix to the name.
Loop from 1 up to some maximum number, doing the following:
Construct a proposedName from base and number:
If number is 1, use the bare prefix.
Otherwise, concatenate the prefix and number in the format you're looking to generate.
Check if proposedName is already in use.*
If it is in use, increment number and loop again.
If it is not in use, proposedName is your new name.
Given that you're using a SQLite database, you can probably speed this up a bit by pre-fetching names that begin with your prefix and loading them into an NSMutableSet. That'll be faster than performing a query for each individual name.
* When you do this test, you should probably exclude the object you're already looking at. This will allow you to try to "uniquify" the name of an existing object without actually changing it.

Create a report that could be one page or two, depending on what field was modified

In an alternate application, the user has the ability to update their address and phone number. When these are changed, three fields will update: Old Value, New Value, and Field Changed. If the Field Changed was the address, I need to create two report pages - one with the old address and one with the new. However, if the Field Changed was the phone number, I only need to create one report page for the current address.
My initial plan was to do a Union that would have one record with the Old Value and another with the New Value. This should work when only the Address has changed. However, it won't whenever the Phone Number has changed. I assume I need to do some sort of case statement, but I'm not really sure if this is the right approach. Sorry if the data is a little confusing (I didn't design the data structure. This was provided by our professor's assistant). If you need more information, I'll try to provide it.
I'm not looking for exact SQL, but I am wondering if I'm approaching this the correct way.
What do you mean by a 1 or 2 page report? Are you outputting to a CSV, PDF, XLSX or something eles?
If you need to do this through "pure" sql I would recommend a stored procedure that is given a value stating whether it's the address or phone number that is being updated. It can then do the update and you can simply do an if statement which determines which report to run and return.
I'd recommend handling it programatically if possible. Have your code run the sql update and then call the appropriate function within your code to get the report you need. You can then easily re-use the code for that report in other ways.