|
Eddy Vluggen wrote: OriginalGriff wrote: and the VB was written by an idiot. I thought that was the default case.
|
|
|
|
|
That was a fantastic reply. Well done
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
How would you write a code where you asked to write a code using Luhn Algorithm
with the numbers 49927398716 using two methods .The first method will be called GenerateCheckDigit;A method to generate a checkdigit, and the other method is called ValidationNumber; A method to confirm whether a give number is valid by making use of Luhn algorithm
Please help me
Thank you in advance
|
|
|
|
|
I would start by researching the Luhn algorithm itself. There must be good resources online that describe the algorithm, possibly with pseudo-code. Once I had that, I would pull together an initial implementation; using known-good outputs to validate my implementation against.
What code do you currently have and where are you stuck?
|
|
|
|
|
Start by typing "Luhn Algorithm" into Google. This has been documented all over the web, with examples.
|
|
|
|
|
We are more than willing to help those that are stuck: but 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.
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.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Start with the related Wikipedia page[^], there is even the pseudocode implementation.
|
|
|
|
|
I wonder what your instructor would think knowing that you're asking other people to do your assignment
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I need to use a DataTable's column number in a switch statement.
I am having problems with the following:
const Int32 xxxColumn = (Int32)DataTable.xxxColumn.Ordinal;
switch (n)
{
case xxxColumn: ********; break;
}
How do I get a constant value from a DataTable column ordinal.
Any help will be appreciated,
Thanks in advance,
Michael
|
|
|
|
|
The parameter in a switch statement must be an actual constant whose value is available at compile time. Your code is using a variable that is not available to the compiler. You will need to use an if statement.
|
|
|
|
|
See if this gives you useful ideas:
public class SwitchOnDTOrdinal
{
public SwitchOnDTOrdinal(DataTable table)
{
TheTable = table;
validColumnNames = table.Columns
.Cast<DataColumn>()
.Select(col => col.ColumnName)
.ToList();
}
private List<string> validColumnNames;
private DataTable TheTable;
public void SwitchA(string cname)
{
if (! validColumnNames.Contains(cname))
{
throw new ArgumentException(@"{cname} is not a valid column name");
}
switch(TheTable.Columns[cname].Ordinal)
{
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
default:
throw new ArgumentOutOfRangeException();
}
}
}
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
modified 1-Oct-19 6:48am.
|
|
|
|
|
Hi,
for Ordinal I agree with what has already been said. However you might consider working with the columns Name or Caption property; if one of those has known values you can still use a simple switch, as C# allows switching on string literals.
|
|
|
|
|
Dear all,
In my computer, there are have a software that used to encryte excel file.
All of these excel files can only read on computers that have this encryption / decryption program
I will make an C# system to load these excel files to datagridview.
Look forward to the help of all
Thanks all!
|
|
|
|
|
HoaiNTT0610 wrote: Look forward to the help of all To do what exactly?
|
|
|
|
|
At time of posting, there are 14,311,184 members at CP. Do you really want all of them to help?
Seriously though, you need to elaborate what help you are looking for.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
There is nowhere near enough information here for us to begin to help you - we have no idea what this " software that used to encryte excel file" is, what encryption method(s) it uses, how you use it, or how you propose to use it.
We don't even have any idea where you are stuck, or what help you might need - and that's kinda important, don't you think?
Start here: Asking questions is a skill[^] and think about what you need to know, and what you need to tell us in order to get help.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
In Subclassing the edit control wparam in wm_nccalcsize return 1 only not 0 , and give me rgrc0 or rgrc1 bottom or right Zero so cannot decrease right of non client area and draw edge , before subclassing the Edit Control i used swp_framechanged in SetWindowpos to draw new style
|
|
|
|
|
You already posted this in the C/C++/MFC forum. Please do not repost.
|
|
|
|
|
This doesn't appear to have anything to do with C#.
|
|
|
|
|
This is a clear question if somebody know api function can answer my problem , how programmer draw rectangle in edit control ? we have to reduce the client width then put rectangle .. now why can not set rgrc0
|
|
|
|
|
It's not that clear - even in the right forum - but as a C++ question in a C# forum? It's not relevant, and thus not a "good question".
You have it posted in the right place: "scatter shot" posting it in irrelevant places doesn't improve your chances of an answer, it reduces them - because it wastes our time, and does not inspire me to go near the right place to answer it.
In essence: it's childish "attention getting" behavior and from an adult who should know better by now, that's rude.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hello everybody.
My application runs in Windows Embedded Compact 7,is written in C# and it uses .NET Compact Framework 3.5.
In the application there is a form, I call it FormMain, two UserControlls, Page01_UC and SetupHome_UC, another form, FormDateTime.
In FormMain i declared:
public static Page01_UC uc1 = new Page01_UC();
public static SetupHome_UC uc2 = new SetupHome_UC();
public static FormDateTime uc3 = new FormDateTime();
In the FormMain load event:
uc1.Parent = this;
uc1.Location = new Point(0, 0);
uc1.Page02_UC_Load();
uc1.Show();
In the uc1 UserControl there is a checkbox used to show SetupHome_UC:
private void SetupCB_CheckStateChanged(object sender, EventArgs e)
{
if (SetupCB.Checked)
{
FormMain.uc1.Hide();
FormMain.uc2.Parent = FormMainRef;
FormMain.uc2.Location = new Point(0, 0);
FormMain.uc2.Page02_UC_Load();
FormMain.uc2.Show();
SetupCB.Checked = false;
}
}
In uc2 UserControl ther is a button to show FormDateTime:
private void DateTimeBt_Click(object sender, EventArgs e)
{
FormMain.uc3.ShowDialog();
}
...at the end... in uc3 there is a button to close the form:
private void AbortBt_Click(object sender, EventArgs e)
{
Close();
}
I can show/close uc3 (FormDateTime) many times without problems but sometimes it happens that I get an ObjectDisposedException when I push the button to show uc3.
I thought that uc3 should not be disposed but it seems that sometimes it happens.
Have I made any mistakes that I don't see?
There is a way to make uc3 UNdisposable until the application is closed?
...or any other way to avoid this problem...
Thanks in advance.
|
|
|
|
|
Make it modeless. Instead of using form.ShowDialog() , use form.Show() . Whatever button you use to close the ford should hide it instead, using form.Hide() .
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Thank you #realJSOP for your answer.
I can't apply your solution because the form I show must stay over the others and must be closed to let user access to the window below, so I need a ShowModal().
|
|
|
|
|
ShowModal will ALWAYS dispose your form when you close it. If you need data shown in the window to be retained, you're going to have to store it in a static class so you can recall it whenever you need it.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|