Error CS0103: The name 'Properties' does not exist in the current context
Error CS0103: The name 'Properties' does not exist in the current context
15 Jul 2021, 14:58
What's wrong with this code?
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
// This sample shows how to use image control to show images
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FileSystem)]
public class ImageSample : Indicator
{
protected override void Initialize()
{
var image = new Image
{
// Logo is an icon file inside project resources
Source = Properties.Resources.Logo,
Width = 200,
Height = 200,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
};
Chart.AddControl(image);
}
public override void Calculate(int index)
{
}
}
}
Replies
AlexFrei
02 Nov 2023, 10:09
( Updated at: 02 Nov 2023, 12:08 )
RE: Error CS0103: The name 'Properties' does not exist in the current context
PanagiotisCharalampous said:
Hi prlozc,
I think the message is clear, you use an object called Properties that is not defined anywhere.
Best Regards,
Panagiotis
Yes, but this code is from your sample and documentation: https://help.ctrader.com/ctrader-automate/references/Controls/Image/
I have the same problem.
How to resolve it please ?
@AlexFrei
PanagiotisCharalampous
02 Nov 2023, 12:12
( Updated at: 02 Nov 2023, 12:13 )
RE: RE: Error CS0103: The name 'Properties' does not exist in the current context
AlexFrei said:
PanagiotisCharalampous said:
Hi prlozc,
I think the message is clear, you use an object called Properties that is not defined anywhere.
Best Regards,
Panagiotis
Yes, but this code is from your sample and documentation: https://help.ctrader.com/ctrader-automate/references/Controls/Image/
I have the same problem.
How to resolve it please ?
The code is calling a file from the projects resources. You need to add resources to your project. Read more below
https://learn.microsoft.com/en-us/dotnet/core/extensions/create-resource-files
@PanagiotisCharalampous
AlexFrei
03 Nov 2023, 09:48
( Updated at: 03 Nov 2023, 13:16 )
RE: RE: RE: Error CS0103: The name 'Properties' does not exist in the current context
PanagiotisCharalampous said:
AlexFrei said:
PanagiotisCharalampous said:
Hi prlozc,
I think the message is clear, you use an object called Properties that is not defined anywhere.
Best Regards,
Panagiotis
Yes, but this code is from your sample and documentation: https://help.ctrader.com/ctrader-automate/references/Controls/Image/
I have the same problem.
How to resolve it please ?
The code is calling a file from the projects resources. You need to add resources to your project. Read more below
https://learn.microsoft.com/en-us/dotnet/core/extensions/create-resource-files
Thank you for your reply. I had of course created resources /resx file in my project with png image. But it didnt work. So I tried remove all resources and created it again and now it works well and object Properties and Resources (logo included) exist.
I have no clue why it havent worked before
@AlexFrei
AlexFrei
08 Nov 2023, 13:52
( Updated at: 09 Nov 2023, 06:30 )
RE: RE: RE: Error CS0103: The name 'Properties' does not exist in the current context
PanagiotisCharalampous said:
AlexFrei said:
PanagiotisCharalampous said:
Hi prlozc,
I think the message is clear, you use an object called Properties that is not defined anywhere.
Best Regards,
Panagiotis
Yes, but this code is from your sample and documentation: https://help.ctrader.com/ctrader-automate/references/Controls/Image/
I have the same problem.
How to resolve it please ?
The code is calling a file from the projects resources. You need to add resources to your project. Read more below
https://learn.microsoft.com/en-us/dotnet/core/extensions/create-resource-files
Hello, today I created new Bot, I added image to resource and It doesnt work again. Properties not exists.
Souluion is easy. I had to add namespace Bot.Properties to using and then referenced image in source without Properties: Source = Resources.Logo
@AlexFrei
PanagiotisCharalampous
16 Jul 2021, 08:25
Hi prlozc,
I think the message is clear, you use an object called Properties that is not defined anywhere.
Best Regards,
Panagiotis
Join us on Telegram and Facebook
@PanagiotisCharalampous