|
my god i am tierd please help me.
|
|
|
|
|
i dont english as well .from all friend want to guide me for solve my problem.
i am very very hope that this site firend my problem resolved...
best regards
modified 6-Oct-14 13:01pm.
|
|
|
|
|
i have one table with 3 column=code,name,code_b
and in form i have a bindingnavigator that addnewitem=none and bindingsource=fatemebinding
and in gridex datasourc=fatemebinding and in gridex allownew=addnew and rowheader=true and headercontent =rowposition and in griddesignert click in createroottable and retrive table and then column table ceated and then code envirement
newiconbinding:
[php]
try
{
fatemeBindingSource.AddNew();
codmax = Convert.ToInt32(fatemeTableAdapter.maxcode());
codmax = codmax + 1;
gridEX1.CurrentRow.Cells["code"].Value = codmax;
((DataRowView)fatemeBindingSource.Current).Row["code"] = codmax;
}
catch
{
MessageBox.Show("لطفا اطلاعات را وارد کنید");
}
[/php]
and save iconbindingnavator:
[php]
private void toolStripButton1_Click(object sender, EventArgs e)
{
fatemeBindingSource.EndEdit();
fatemeTableAdapter.Update(this.baziDataSet1.fateme);
}
[/php]
but in run name and code_b value to be null
how to asign data column
please help me
|
|
|
|
|
Hallo, this is my first post but i am stuck on a question.
* Write a program that prompt the user for a single integer.
* The program will display if the number is a multiple of
* 2 or 3 or both or neither 2 nor 3. Use the modulus (%) to check
* for divisibility
*
* You must use an if statement for this solution
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Question3
{
class Program
{
static void Main(string[] args)
{
int integer;
Console.Write("Enter an integer: ");
integer = Convert.ToInt32(Console.ReadLine());
if(integer == integer / 2 && integer == integer / 3)
{
Console.Write(integer + " is a multiple of both 2 and 3.");
}
if (integer == integer / 2)
{
Console.Write(integer + " is a multiple of 2.");
}
else if (integer == integer / 3)
{
Console.Write(integer + "is a multiple of 3");
}
if (integer != integer / 2 && integer != integer / 3)
{
Console.Write(integer + " is not a multiple of either 2 or 3");
}
}
}
}
It looks un-alligned but I think that is because when I paste it here it didn't have enough width room.
I do not know what I did wrong with the if, else if, and else part.
When I try to run it, no matter what integer i put it always shows up being neither a multiple of 2 and 3.
|
|
|
|
|
You are not using the modulo (%) operator [^].
Example:
int testInt = 23;
bool isMultipleOf2 = testInt % 2 == 0; // false
testInt = 21;
bool isMultipleOf3 = testInt % 3 == 0; // true
Try and think carefully about the logic you need to apply in your evaluations; your goal should be to have the minimum number of if/else statements, and to avoid repeating evaluating the integer argument more than once for any given condition.
A good thing to do while developing is to set a break-point at the start of your routine, and single-step through the code (you can use F11 in Visual Studio): examine the values of the variables at each line of code, and watch the flow-of-control in the code.
« There is only one difference between a madman and me. The madman thinks he is sane. I know I am mad. » Salvador Dali
modified 5-Oct-14 16:19pm.
|
|
|
|
|
if((integer % 2 == 0) && (integer % 3 == 0))
{
Console.Write(integer + " is a multiple of both 2 and 3.");
}
else if (integer % 2 == 0)
{
Console.Write(integer + " is a multiple of 2.");
}
else if (integer % 3 == 0)
{
Console.Write(integer + "is a multiple of 3");
}
else
{
Console.Write(integer + " is not a multiple of either 2 or 3");
}
Please refer the following useful materials,
http://msdn.microsoft.com/en-us/library/67ef8sbd.aspx[^]
http://msdn.microsoft.com/en-AU/library/ms173145.aspx[^]
It's very important to learn the basics of the language. Spend more time in read and learn.
|
|
|
|
|
This looks suspiciously like a homework type question
|
|
|
|
|
|
Hello Everyone, Can someone please help me out I am getting
NullReferenceException error and I don't understand why.
Error: Object reference not set to an instance of an object.
at WindowHome.xaml.cs:line 283
Code:
public void GetTransactionData()
{
DateTime today = DateTime.Now.Date;
List<Transaction> newTransactionList = DataManager.GetTransaction();
List<Transaction> TransactionDataGridData = new List<Transaction>();
var CurrentMonthTransaction = (from item in newTransactionList
where ((int)item.Date.Month == today.Month)
where ((int)item.Date.Year == today.Year)
select item);
try
{
foreach (Transaction item in CurrentMonthTransaction)
{
TransactionDataGridData.Add(item);
}
if (TransactionDataGridData.Count >= 1)
{
dgvTransactionList.ItemsSource = TransactionDataGridData.ToList();
decimal transactionTotal = (from item in TransactionDataGridData
select Convert.ToInt32(item.Amount)).Sum();
txtTotalTransaction.Content = "Total: " + string.Format("{0:C}", transactionTotal);
}
}
catch (Exception error)
{
MessageBox.Show(error.ToString());
}
}
I have underlined where I get the error
Thanks!
Saeed
modified 4-Oct-14 13:39pm.
|
|
|
|
|
You might want to specify on which line the error occurs.
|
|
|
|
|
I have underlined it.
Saeed
|
|
|
|
|
I'd say that _dgvTransactionList has to be null or the code would have crashed earlier in the method.
|
|
|
|
|
Hi,
Put a debugger on try{} and see the values in the list. See the quick watch where you are getting null. Check if the FieldNames used for GridColumns in the xaml are same as the names in the list. For example, your list has fields like Id, Name then the GridColumn field names should also be Id and Name.
Please revert in case you find something.
Regards,
Praneet
|
|
|
|
|
I created a new window and everything is working fine. I don't know why I was getting the error, because the code is working. when I got the error and clicked OK, All the data in the DataGrid was loaded correctly but I was still getting the error on every restart. By the way I am new to programming.
Thanks anyway for all the help.
Regards,
Saeed
Saeed
|
|
|
|
|
Hello,
I am developing a project in "Windows Application using c#" there is a requirement for disabling the whole row after when send mail button is click. The process is that there is a button after each row in grid view this button is "Send Mail" button when user click this button the whole data which is in a particular row will be bind in message body and it will be send to particular mail id and the another requirement is that after clicking this button that row must be shown disabled means in a grey color and that button also to be shown disabled .
I am searching but not getting the answer please help me giving the logic behind this .
Thanks
|
|
|
|
|
|
Thanks for reply, but I had tried this it doesn't work
i just want to disable the datagridview column button after performing its action means when user click the gridview send mail column button just only after clicking the button must be disabled.
please provide any other solution.
thanks
|
|
|
|
|
I need to get the stack trace many, many times. There is new StackTrace(true), but its hella slow. Found an article about calling GetStackFramesInternal() instead, so I tried that. It did improve performance a little bit (about 22%). Better then nothing I guess. Obviously, the majority of the time spent is getting the file & line info since StackTrace(false) is much faster then StackTrace(true). I tried using ILSpy to see what the hell was taking so long, but it appears the stack trace and file info is gathered in the unmanaged C world as .NET just calls a C function to get it after a few layers. I understand you have to parse the PDB file to get the file and line info, and I know nothing about the file format, but I'm wondering if that can be improved?
|
|
|
|
|
What are you really trying to achieve?
First you need to gather an ETW trace, then you will be much clearer where time is spent. If the same stack is used over and over again, may be subsequent calls would be much faster.
If possible, try to log an ETW event with stack, then you can do offline analysis with full stack.
|
|
|
|
|
Don't rely on the StackTrace. It's notoriously unreliable, especially in release builds.
|
|
|
|
|
Why does it seem like you're trying to use a stack trace for something it was never intended for?
What are you really doing with this information?
|
|
|
|
|
Umm... getting the stack trace? . That is actually what I'm using it for. I'm writing a logger. Except its intended to be an ultra high performance logger. Getting the stack trace a million times is kinda expensive .
|
|
|
|
|
Yeah, so why would you possibly need the stack trace "a million times"??
I would never need a log of calls that fine grained and so often.
|
|
|
|
|
You probably wouldn't need the stack trace "a million times" per say. But its not unfathomable to have a million log entries or much more. For example, at work, we log every request we get for our newer main product. That table has 1 - 2 million entries right now and its not even fully in production yet.
Unfortunately, as you can imagine, its not possible to get the stack trace retro actively. My logger is highly configurable (think something like Log4Net), so right now I don't know if the stack trace is going to be needed because of how the API is designed.
I grab the stack trace when a log entry is created. However, I guess if I change up the API a little bit, I can make it so the logger knows if someone has registered to get the stack trace, and if not, I don't need to new the stack trace object up.
I dunno about you, but I always like to make my application building blocks as insanely fast as possible. A house built on crap will end up being crap.
That's the reason I don't use Autofaq, MEF or Ninject as my IOC container. While I don't create apps that new up 500k objects through IOC every day, it's nice to know that if I want to, I can do so in 100 - 200ms (MEF2 for example) instead of 7 seconds (Ninject for example).
Not only that, its a little bit of bragging rights to say you have the fastest component x on the planet.
|
|
|
|
|
Uhhhh....yeah. Whatever.
I still don't ever see the need for a stack trace on every log entry call. Think about that for a minute. What are you going to get in the stack trace? A million examinations of the call to the log component!
The problem with get a tack trace is that the thread is stopped, the entire stack is walked looking for return addresses, symbols resolved, then you get you're trace and thread is resumed.
You're basically not going to get what you would call a "high performance" stack trace. The operation is just too expensive.
|
|
|
|