Hi I want to use applications Settings to retrieve some default properties of my WinForm
and I've also included using WinForm.Properties .
But I get this error
Error 1 'WF_Certificate.Properties.Settings' does not contain a
definition for 'BaudRate' and no extension method 'BaudRate' accepting
a first argument of type 'WF_Certificate.Properties.Settings' could be
found (are you missing a using directive or an assembly
reference?) C:\Users\saadat\Documents\Visual Studio
2012\Projects\WF_Certificate\WF_Certificate\Form1.cs 44 41 WF_Certificate
on this line:cmbBaudRate.Text = settings.BaudRate.ToString();
note : I declared
SerialPort comport = new SerialPort();
and
Settings settings = Settings.Default;
I'm confused . Am I missing something?
If your settings class name is Settings1, then you can use:
cmbBaudRate.Text = Settings1.Default.BaudRate;
You do not need to do anything else. Make sure you have created the BaudRate setting first.
Related
EDIT: Thank you everyone! I have never upgraded to a newer version of
.NET and language version before. Thus didn't know about .csproj
configuration. Even though I did a research before posting a question
I was not able to find a solution myself. So, I just leave these two
links for further reference, perhaps this might help someone as well.
https://learn.microsoft.com/en-us/dotnet/standard/frameworks
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version
I have upgraded to .NET 5.0.301
And finally got around to try record type in C# 9.0
I wrote a simple code but got an error during compilation.
I use Visual Studio Code as an editor.
VS Code version 1.57.0
C# extension version 1.23.12
Here is my settings.json:
"editor.semanticHighlighting.enabled": true,
"csharp.semanticHighlighting.enabled": true,
"omnisharp.path": "latest"
Set up:
dotnet new sln -n "Test"
dotnet new console -n "TestProject"
dotnet sln Test.sln add .\TestProject\TestProject.csproj
My code:
using System;
namespace TestProject
{
class Program
{
static void Main(string[] args)
{
var person = new Person() { Name = "Tom" };
person.Name = "Bob";
Console.WriteLine(person.Name);
}
}
public record Person
{
public string Name { get; set; }
public int Age { get; set; }
}
}
Problems:
CS0246 The type or namespace name 'Person' could not be found (are you missing a using directive or an assembly reference?)
CS0246 The type or namespace name 'record' could not be found (are you missing a using directive or an assembly reference?)
CS0548 '<invalid-global-code>.Person': property or indexer must have at least one accessor
CS1513 } expected
CS0116 A namespace cannot directly contain members such as fields or methods
CS1022 Type or namespace definition, or end-of-file expected
Any help much appreciated
Check your target framework and language version in your .csproj file. You should find something like:
<TargetFramework>net5.0</TargetFramework>
<LangVersion>9.0</LangVersion>
If you don't find these properties, add them inside the <PropertyGroup>...</PropertyGroup> tags. If they are set to older versions, change them.
If this does not solve your problem, you may have installed your .NET SDK incorrectly, or you may have installed it in a directory other than the default one and the VS Code C# extension is not able to find it.
I'm trying to get a list of folders and RDL files in those folders on an SSRS 2008 server and I'm getting the following messages when trying to iterate through the folders.
'ReportExecutionService' does not contain a definition for 'ListChildren' and no accessible extension method 'ListChildren' accepting a first argument of type 'ReportExecutionService' could be found (are you missing a using directive or an assembly reference?)
var rs05 = new SSRS2005.ReportExecutionService();
rs05.Url = "http://<servername>/ReportServer/ReportService2005.asmx?wsdl";
rs05.Credentials = System.Net.CredentialCache.DefaultCredentials;
var reports = rs05.ListChildren("/");
I have it exactly as every example out there. Is ListChildren not exposed? Am I missing something?
In a simple project i want to reference objects from a webreference added to another c# library.
The Webreference is called QServices The default namespace is set as below
What seems to work is the following code:
Taskworkflow.SI.QServices.Record[] querysResult = new Taskworkflow.SI.QServices.Record[0];
yet when i import the Taskworkflow.SI - namespace, i keep on getting errors:
using TaskWorkflow.SI;
....
QServices.Record[] querysResult = new QServices.Record[0];
This results in the error:
The type or namespace name 'QServices' could not be found (are you missing a using directive or an assembly reference?)
Could someone clarify this for me?
Thank you for your time.
Note: QServices do only exist inside TaskWorkflow.SI. They do not have any occurences in other projects nor do they have any classes/namespaces/objects that share the name.
I strongly suspect that for whatever reason, you're ending up with a namespace called QServices declared in the TaskWorkflow.SI namespace. So actually you want:
using TaskWorkflow.SI.QServices;
....
Record[] querysResult = new Record[0];
Or you could explicitly alias it:
using QServices = TaskWorkflow.SI.QServices;
....
QServices.Record[] querysResult = new QServices.Record[0];
Note: I am using CR13 with VS 2010.
I am creating winform app.I want to create report dynamically,
I got reference of one of link in which the guy had created report dynamically:
http://www.xtremevbtalk.com/archive/index.php/t-248952.html?
I want same thing but i couldn't. I have create my report's instance as
EmployeeReport empRpt = new EmployeeReport();
then want to add TextObject as like
empRpt.section3.AddTextObject("Print Date: ", 0, 890).
But VS2010 gives me error that:
Error 16 'CrystalDecisions.CrystalReports.Engine.Section' does not
contain a definition for 'AddTextObject' and no extension method
'AddTextObject' accepting a first argument of type
'CrystalDecisions.CrystalReports.Engine.Section' could be found (are
you missing a using directive or an assembly reference?
Any suggestions?
empRpt.Section(3).AddTextObject("Print Date: ", 0, 890")
^here
I am trying to insert/add a data into my Database but it seems that this part of code won't work The name of the table that I am trying to add data on is "People"
Table<People> users = myDb.GetTable<People>;
Has an error on the Table<People> users why is this error occurring?? how would I fix this?
just in case you need the stack trace, here it is.
Error 1
The type or namespace name 'Table' could not be found (are you missing a using directive or an assembly
reference?)
C:\Users\John\documents\visual studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs 23 13 WindowsFormsApplication1
You need to add
using System.Data.Linq;
to the top of your file to bring the Table class into scope. Alternatively you could use:
var users = myDb.GetTable<People>();