|
I dont know if I understand what you mean. Actually I had a save button as you says. I'm not tgrying to do a sort of auto saving anytime user change the text.
Actually the user have to do 2 operations in order to save a row: click on enter and then click on my save button. I just was trying to eliminate the first step (the enter click who should be included into my save button)
many many thnaks for suggestion
|
|
|
|
|
someone have an exemple of code for validate automatically a row in a datagridview without force the user to click enter key?
|
|
|
|
|
hi all
i am using directshow lib to capture web cam in my application
all is gud capture image is ok
but the webcam video screen not display properly
i pass icture control handle of form to diaply webcam on my form
Rectangle rc = hControl.ClientRectangle;
ivw.SetWindowPosition(rc.X, rc.Y, rc.Width , rc.Height);
please help me for this.
thank
|
|
|
|
|
We can't tell - we have no access to the rest of your code, or any idea what is actually happening because we just can't see your screen!
But at a guess, it's because you are expecting the coordinates of the ClientRectangle to be directly usable in a different control, and that may not be the case - it'll depend on a huge number of factors including whatever the IVideoWindows interface is doing with the data when you call it's SetWindowPosition method. Chances are that's in absolute terms (so desktop coordinate based) while the ClientRectange returns a position based on the control container.
Use the debugger to see exactly what you are getting, and compare that with the actual position your video is being shown at.
Sorry, but we can't do any of that for you!
"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!
|
|
|
|
|
Hi
I'm trying to create a "FinalDocument" list from another list "OriginDocument"
The problem is that the "FinalDocument" does not have the correct Client Code.
So I want to get this Client Code from a third List "clients", for that I use the "TaxClienteID" field
It would be something like this:
List<FinalDocument> finalDocument = originDocument.Select(p => new FinalDocument()
{
documentcode = p.documentcode,
date = p.date,
...
codcliente = clients.codcliente where (TaxClienteID = clients.TaxClienteID)
})
I'm not getting it, the best I could get was with this:
List<FinalDocument> finalDocument = originDocument.Select(p => new FinalDocument()
{
documentcode = p.documentcode,
date = p.date,
...
clientcod = clients.Select(j => j.clientcod).Where(u => clients.Select(c => c.TaxClienteID.ToString()).Contains(p.TaxClienteID)).ToString()
}
But I get this in the customer clientcod field:
"System.Linq.Enumerable+WhereEnumerableIterator`1[System.String]"
and I don't know how to extract the value.
I'm sure there is a much simpler way, but I can't find it.
someone can help me?
|
|
|
|
|
Try something like
codcliente = clients.FirstOrDefault (c => p.TaxClienteID == c.TaxClienteID).clientcod
Can't guarantee it, I have no idea of your classes or the interactions between them ...
"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!
|
|
|
|
|
thank you very much, it is working perfectly. Greetings
|
|
|
|
|
You're welcome!
"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!
|
|
|
|
|
That will give a null reference exception if p.TaxClienteID is not found in clients.
Truth,
James
|
|
|
|
|
Yep.
I'm not doing all his work for him!
"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!
|
|
|
|
|
This should be the "proper" version of what you want:
void Main()
{
var originDocument = new List<FinalDocument>();
var clients = new List<Client>();
List<FinalDocument> finalDocument =
(from p in originDocument
join c in clients on p.TaxClienteID equals c.TaxClienteID
select new FinalDocument
{
documentcode = p.documentcode,
date = p.date,
codcliente = c.codcliente
}).ToList();
}
class FinalDocument
{
public string documentcode { get; set; }
public DateTime date { get; set; }
public string codcliente { get; set; }
public string TaxClienteID { get; set; }
}
class Client
{
public string codcliente { get; set; }
public string TaxClienteID { get; set; }
}
Truth,
James
|
|
|
|
|
Thanks James, this code was very useful
Regards
Rui
|
|
|
|
|
hi all,
i got this error
<br />
Mixed mode assembly is built against version 'v2.0.50727' of runtime and cannot be loaded in the 4.0 runtime without additional configuration.<br />
i changed my app.config file but still this occur.
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<!-- 4.0 RTM -->
<supportedRuntime version="v4.0.30319"/>
<!-- 2.0 RTM -->
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
please help for this.
|
|
|
|
|
Try adding this to app.config:
<startup useLegacyV2RuntimeActivationPolicy="true" />
"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!
|
|
|
|
|
Of course since Microsoft got rid of DLL hell this is so easy.
|
|
|
|
|
i already use it, and mentioned it above
|
|
|
|
|
That attribute is the solution to the error you're getting. Are you sure you've updated the correct config file?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
(1) does this block on the first item's await or will await on all?
(2) if the latter, what's the implication if the wrapped http client in
GetItemChildAsync is a singleton?
foreach (var i in items)
{
await GetItemChildAsync(i.Id);
}
|
|
|
|
|
1) Technically, the whole point of await is that it doesn't "block". It simply creates a continuation callback representing the rest of the method, and passes that to the task being awaited.
However, from a logical perspective, the rest of the method is "blocked" until the task returned from GetItemChildAsync completes. That happens when the task is awaited, so it "blocks" on the first item.
If you wanted to start all of the tasks at the same time, and then wait for them all to complete, you would use the Task.WhenAll method[^]:
IEnumerable<Task> tasks = items.Select(i => GetItemChildAsync(i.Id));
await Task.WhenAll(tasks);
2) None whatsoever. The HttpClient class[^] is safe to call from multiple threads at the same time. In fact, a singleton used to be the recommended way to use this class[^]. However, the current recommendation is to use the IHttpClientFactory service[^] to create an HttpClient instance on demand.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I want to convert dates come from database. I have the following API action:
[HttpGet]
public async Task<IActionResult> GetSpecialPostsList()
{
var posts = await myContext.Posts.Where(x => x.IsSpecialPost == true && x.IsActive == true).ToListAsync();
if (posts != null)
{
var revisedPost = new RevisedPost();
var revisedPostList = new List<RevisedPost>();
foreach (var post in posts)
{
revisedPost.CreationDate = DateConverter.GregToPersianDate(post.CreationDate.ToShortDateString());
revisedPost.Description = post.Description;
revisedPost.ImageFileName = post.ImageFileName;
revisedPost.IsActive = post.IsActive;
revisedPost.IsMainPost = post.IsMainPost;
revisedPost.IsSpecialPost = post.IsSpecialPost;
revisedPost.Title = post.Title;
revisedPost.Id = post.Id;
revisedPostList.Add(revisedPost);
}
return Ok(revisedPostList);
}
return NotFound("Data not found!");
}
The problem is that when new data is added to the list, all the items in the list are updated to the latest item values. This means all the items in the list are the same.
What is wrong with my code?
|
|
|
|
|
You keep updating and adding the "same" revisedPost object in your for loop (instead of creating a new instance). "Adding" does not make "copies" of "reference" (i.e. class) objects.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Thanks. I put the following code inside the loop and the problem solved.
var revisedPost = new RevisedPost();
|
|
|
|
|
In your send line, "posts" will also be non-null, so that if() will always be true. It should be if(posts.Any())
Truth,
James
|
|
|
|
|
I need to be able to send text to a selected worksheet that is already opened.
This, I think is close but it didn't work:
<pre lang="C#">
string wb = cmb_BookName.Text.ToString();
string ws = cmb_SheetName.Text.ToString();
if (chkContainer.Checked)
{
Excel.Application oexcel = new Excel.Application();
Excel.Workbook wkbk = (Excel.Workbook)oexcel.Workbooks[wb];
Excel.Worksheet wksk = (Excel.Worksheet)wkbk.Sheets[ws];
Range cellRange = wksk.Range["D48:D48"];
cellRange.Value = cboContainer.Text;
}
</pre>
The code builds without errors but when running it stops at the line trying to get the workbook and gives me an Exception Unhandled message.
So basically my question still is how do I work with an excel workbook that is already opened?
Seems like most of the articles that I find are opening an excel file and then working with it. In my case, I need to work with an already opened excel workbook.
|
|
|
|