|
In my project, i was used a control of PropertyGrid, and i bind a object(the instance of my class). The drop-down list-box item of propertygrid could be drop down only once. there is nothing showing when i click the drop-down button again.(the list item just like bool, enum variables) And surprisedly, i can't close this window.
So, help me, please...
a poor guy diging C#
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
So start with the code: what are you doing when it drops down? How are you binding it? What does your class contain? What is it derived from? Do you override ToString? Anything else that might be relevant?
Only you can look at things like this: we can have no idea without much, much better information!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Works for me, even on Linux using mono.
Can you post some code to reproduce the problem?
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I have requirement where we have 2 exe's. When first exe started then I have to call method of second exe which will do some process. once that process is completed then it again intimates first exe that my work is done. you can resume your work.
Note: I do not want to use sockets. Most preferred way is like Mutex or Semaphore.
Any help will be much appreciated.
|
|
|
|
|
|
|
Source of Integral Calculation Program Using Random Numbers Generation (Kaufman)
with c#,c++,Python
|
|
|
|
|
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you. We are not a "code to order" service!
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I was given a medium sized app, about 50,000 line total. It will not shut down on its own. You either have to kill it the debugger or go to Task Manager to kill it there.
I have hit things like this before. You create a child and then kill the parent. You have lost the handle to the child and cannot close it. The app hangs when shutting down. Before I was building the program and knew when this happened. I only had to backtrack a little bit to find the problem.
Now I have something written by someone else. When you kill the app even in the debugger you loose the stack panel. How can I find what the offender is?
So many years of programming I have forgotten more languages than I know.
|
|
|
|
|
If it's a windows app (implying there is a windows collections), you see if there are are "hidden" windows hanging around (by querying the collection).
If it's "looping" in managed code, it will show where if you "suspend" in Debug (not "cancel").
If it's hanging in "unmanaged" code, it gets more interesting.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
see the code how i am creating place holder now. _Yoy has a formula used in excel.
private string _Yoy = @"IF(AND(ISNUMBER(C#),P#>0,NOT(ISERROR(C#/P#))),C#/P#-1,"""")";
public string YoY
{
get { return _Yoy; }
set { _Yoy = value; }
}
private void button1_Click(object sender, EventArgs e)
{
string strBMFormula = YoY.Replace("P#", "2005.13").Replace("C#", "7777.10");
}
I am replacing P# & C# with some value at runtime and program working as expected but i am doing this in large loop where Replace() function is getting called repeatedly which may increase memory use.
@"IF(AND(ISNUMBER(C#),P#>0,NOT(ISERROR(C#/P#))),C#/P#-1,"""")";
here i gave 4 double quote because there would two double quote in excel function.
i am using .Net version 4.5
so please suggest me how to create a place holder in string variable and put my value there without using Replace function.
i try this approach too but still no luck.
private void button1_Click(object sender, EventArgs e)
{
string strBMFormula = Replacement("A10", "Z210");
}
private string Replacement(string value1, string value2)
{
return @"IF(AND(ISNUMBER({value1}),{value2}>0,NOT(ISERROR({value1}/{value2}))),{value1}/{value2}-1,"""")";
}
|
|
|
|
|
I got fix for my above code. here it is.
private void button1_Click(object sender, EventArgs e)
{
string strBMFormula = Replacement("A10", "Z210");
}
private string Replacement(string value1, string value2)
{
return string.Format(@"IF(AND(ISNUMBER({0}),{1}>0,NOT(ISERROR({0}/{1}))),{0}/{1}-1,"""")",value1,value2);
}
|
|
|
|
|
You are confused with string modifiers. You are using the verbatim string modifier (@), which allows you to avoid having to escape special characters (no double-antislash, for example).
But you need the interpolated-string modifier, $ .
private string Replacement(string value1, string value2)
{
return $"IF(AND(ISNUMBER({value1}),{value2}>0,NOT(ISERROR({value1}/{value2}))),{value1}/{value2}-1,"""")";
}
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
string interpolation not available in my .net version. i am using c# v5.0 & VS2013.
|
|
|
|
|
First, what's stopping you from using later/latest versions of VS and FrameWork/C# ? Given those are free, why not upgrade ?
Try this:
const string YTemplate = @"IF(AND(ISNUMBER(C#),P#>0,NOT(ISERROR(C#/P#))),C#/P#-1,"""")";
StringBuilder sb = new StringBuilder(YTemplate);
sb = sb.Replace("P#", "2005.13").Replace("C#", "7777.10"); To reuse this, clear the StringBuilder after a use, and then reset its contents to 'YTemplate.
Faster, more efficient ? Lots of different opinions on String.Replace and StringBuilder.Replace: [^]
Do some tests with your data, and find out if it's better for your case.
And, keep your eye on the future: [^]
«The mind is not a vessel to be filled but a fire to be kindled» Plutarch
modified 20-Nov-21 0:09am.
|
|
|
|
|
I am doing this way and it works fine.
public static class StringHelpers
{
public static string BuildFormula(this string formulatemplate, string value1, string value2)
{
return string.Format(formulatemplate, value1, value2);
}
public static string BuildFormula(this string formulatemplate, string value1, string value2, string value3)
{
return string.Format(formulatemplate, value1, value2, value3);
}
}
Calling this way
---------------------
BrokerCountFormula = FormulaTemplate.BrokerCount.BuildFormula(
(StartPeriod + row.ToString()), (EndPeriod + row.ToString()));
|
|
|
|
|
I am doing this way and it works fine.
public static class StringHelpers
{
public static string BuildFormula(this string formulatemplate, string value1, string value2)
{
return string.Format(formulatemplate, value1, value2);
}
public static string BuildFormula(this string formulatemplate, string value1, string value2, string value3)
{
return string.Format(formulatemplate, value1, value2, value3);
}
}
Calling this way
---------------------
BrokerCountFormula = FormulaTemplate.BrokerCount.BuildFormula(
(StartPeriod + row.ToString()), (EndPeriod + row.ToString()));
|
|
|
|
|
Hi All,
As i am using below C# code in Asp.net web api(GET) to pull the records(8 lac records),i am facing an error i.e system.outofmemoryexception was thrown.Can anyone helpme out on this.Thank You.
public HttpResponseMessage GetLocation([FromBody] data data)
{
try
{
ds = objTransactionMgr.Getlocationdetails(data, ref objError);
if (ds.Tables[0].Rows.Count > 0)
{
var JsonList = ds.Tables[0].AsEnumerable().Select(dataRow => new get_location_details()
{
name = dataRow.Field<string>("name"),
order = dataRow.Field<string>("order"),
date = Convert.ToDateTime(dataRow.Field<datetime?>("date")),
location = dataRow.Field<string>("location"),
type = dataRow.Field<string>("type"),
id = dataRow.Field<string>("id"),
category = dataRow.Field<string>("category"),
seq = Convert.ToInt32(dataRow.Field<decimal?>("seq")),
address = dataRow.Field<string>("address"),
uom = dataRow.Field<string>("uom"),
volume = dataRow.Field<string>("volume"),
total = Convert.ToInt32(dataRow.Field<double?>("total")),
task_value = Convert.ToInt32(dataRow.Field<decimal?>("task_value"))
}).ToList();
return Request.CreateResponse(HttpStatusCode.OK, JsonList);
}
else
{
_messages.status = "Success";
_messages.message = "No rows to return";
return Request.CreateResponse(HttpStatusCode.OK, _messages);
}
}
catch (Exception ex)
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message);
}
}
|
|
|
|
|
Simple: don't load so much data.
Either reduce the amount of data your API is returning, or stream the results from the database[^] instead of trying to load them all into memory at once.
NB: If you go with the streaming option, you'll just be moving the error to the client, which won't be able to load the entire response from your API into memory.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard Thank you for your time.
As my client is looking for all the data at once and stream the results from database means what exactly
can u bit explain pls
|
|
|
|
|
Your Getlocationdetails method is currently loading everything into a DataSet . You would need to use a SqlDataReader instead, and write the records to the response as you read them.
Something like this:
public async Task<HttpResponseMessage> GetLocation([FromBody] data data)
{
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new PushStreamContent(async (outputStream, httpContext, transportContext) =>
{
using (var sw = new StreamWriter(stream))
using (var jsonWriter = new JsonTextWriter(sw))
using (SqlConnection connection = CreateConnection())
using (SqlCommand command = new SqlCommand("...", connection))
{
... ADD PARAMETERS HERE ...
await connection.OpenAsync();
using (var reader = await command.ExecuteReaderAsync())
{
if (!reader.HasRows)
{
var serializer = new JsonSerialize();
serializer.Serialize(writer, new { status = "Success", message = "No rows to return" });
return;
}
writer.WriteStartArray();
while (await reader.ReadAsync())
{
writer.WriteStartObject();
writer.WritePropertyName("name");
writer.WriteValue(reader["name"]);
writer.WritePropertyName("order");
writer.WriteValue(reader["order"]);
writer.WritePropertyName("date");
writer.WriteValue(reader["date"]);
...
writer.WriteEndObject();
}
writer.WriteEndArray();
}
}
})
};
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you sooo much for your time Richard i will try and get back to you.
|
|
|
|
|
I am trying to communicate with a EOS Rebel T7 on mac, but haven't had any luck.
I downloaded the latest version of the SDK, but could not test the Objective-C sample because I don't (can't yet) have Xcode on my computer.
I found this C# project to be instructive. Ultimately I was able to get the following C# code to compile without errors:
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using EOSDigital.API;
using EOSDigital.SDK;
namespace ConsoleExample
{
class Program
{
static CanonAPI APIHandler;
static Camera MainCamera;
static string ImageSaveDirectory;
static bool Error = false;
static ManualResetEvent WaitEvent = new ManualResetEvent(false);
static void Main(string[] args)
{
CanonSDK.InitializeVersion();
IntPtr camPtrList;
CanonSDK.EdsGetCameraList(out camPtrList);
int camCount;
CanonSDK.EdsGetChildCount(camPtrList, out camCount);
Console.WriteLine(camCount + " cameras found.");
}
}
}
However, I end up with camCount==0; "0 cameras found". I thought this might be because the EOS Utility (which opens automatically when plugging in the camera) is occupying the necessary resources, however I tried uninstalling EOS Utility and this did not help.
Can anyone provide a simple example that I can test (that doesn't require Xcode) in VS or VScode? Any help or advice would be much appreciated. Thank you!
PS: Figuring out how to compile in VS on mac was a struggle as I am unfamiliar with both, so I'm open to any suggestions for other IDEs/compilers/languages if it will make using EDSDK easier.
|
|
|
|
|
I'm unfamiliar with Canon EDSDK however I found this article[^] on this very site; the article has lots of high votes, but please don't expect it to make your job simpler...
Luc Pattyn [My Articles]
If you can't find it on YouTube try TikTok...
|
|
|
|
|
Hello,
First of all, I would like to inform you that I am not a software developer, I am dealing with it as a hobby.
I made a simple desktop application, there is a picturebox on the form, I want a website to be opened when I click on the picture, but it gives an error. I've been searching for a few days, there are similar issues but no answer.
Methods I have tried.
using System.Diagnostics;
private void pictureBox2_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(@"https://www.website.com.tr/");
}
The error the codes give is "System.ComponentModel.Win32Exception: 'The system cannot find the file specified.' "
Error details.
System.ComponentModel.Win32Exception
HResult=0x80004005
İleti=Sistem belirtilen dosyayı bulamıyor.
Kaynak=System.Diagnostics.Process
StackTrace:
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)
at AcınımHepalama_001.Form1.pictureBox2_Click(Object sender, EventArgs e) in D:\ÖMÜR ÇALIŞMALAR\MU-uygulamarı\AcınımHepalama-001\Form1.cs:line 604
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
|
|
|
|
|