Click here to Skip to main content
12,406,531 members (31,462 online)

Comments by OriginalGriff (Top 200 by date)

OriginalGriff 3hrs 5mins ago View
   
You're welcome!
   
Repost: deleted.
   
Deleted
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. And we have no idea what the rest of your homework question is. Without that, that fragment is completely meaningless.
Use the "Improve question" widget to edit your question and provide better information.
   
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. And we have no idea what the rest of your homework question is. Without that, that fragment is completely meaningless.
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 4hrs 10mins ago View
   
I checked out the Laetitia Casta original, and you're probably right about the NSFW bit. I never saw it before, I must have lead a more sheltered life than I thought... :sigh:
OriginalGriff 4hrs 10mins ago View
   
The form instance may or may not be relevant, and the text boxes (if needed) can be accessed via the Controls collection.
It's not ideal, but I didn't want to muck around with his code more than I had to to show him the outlines of what to do.
Your head is a splode? You is doing me a frighten!
OriginalGriff 5hrs 10mins ago View
   
Repost: deleted.
OriginalGriff 9hrs 20mins ago View
   
No, you need the process - "the solution" wouldn't teach you anything.
And if you rely on getting others to do your homework, you are going to fail the course when it comes to exams as you won;t have any idea how to do anything...
OriginalGriff 11hrs 5mins ago View
   
And what is the exact error?
What line is it on?
OriginalGriff yesterday View
   
:thumbsup:
OriginalGriff yesterday View
   
"username" is just a string - you create a property on your new form and set it in the way I did with UserName.
You know how to create a property, don't you?
OriginalGriff yesterday View
   
Hi Bill!
No, it was just an example of some data you might want to transfer to a new form.
OriginalGriff yesterday View
   
You have an example!
All you have to do is think about it and extend that to work with your specific circumstances.
If we just hand it to you on a plate you don't learn anything, so you can't do it next time!
This really isn't difficult - look at what I wrote and give it a try.
OriginalGriff yesterday View
   
No - it's all the same principle as I showed in the example I gave - it doesn't matter what the source is.
Give it a try, and see how far you get with a little thinking!
OriginalGriff yesterday View
   
Your "new" DB table requires a non-null value in the Availabity column, yes?
Your old table contains null values. So either you need to fix your old table, or decide on a "sensible" thing to do with you get a null. I can't do that for you!
OriginalGriff yesterday View
   
:sigh:
You are supposed to think, not just blindly replace code...
Why do you think I converted it to an integer?
OriginalGriff yesterday View
   
Where is it showing the null?
OriginalGriff yesterday View
   
And?
What happens when you use that code?
OriginalGriff yesterday View
   
What have you tried?
Where are you stuck?
Because you don't just convert code to swap from a procedural console app to an event driven Windows app...
OriginalGriff 2 days ago View
   
No - I have no interest in building a pacman clone! :laugh:
Have a little patience, he may respond tomorrow. It's quite possible that he is in a different time zone and doesn't even know you have asked him yet...
OriginalGriff 2 days ago View
   
You're welcome!
OriginalGriff 3 days ago View
   
That's a proposal, not a "concrete addition" - it may appear, it may not!
OriginalGriff 3 days ago View
   
Yes - Select:
.Where(x => !x.Any(char.IsDigit))
.Select(x => x.Trim())
.Distinct();
OriginalGriff 3 days ago View
   
You're welcome!
OriginalGriff 3 days ago View
   
You're welcome!
OriginalGriff 3 days ago View
   
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.
And this bit:
SELECT DATEDIFF(day,'____-__-__',GETDATE()) AS DiffDate
doesn;t seem to mean anything without a lot of context from your project that we don't have!
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 3 days ago View
   
Unfortunately not - the SqlCommand.Prepare doesn't throw an exception for "bad table name" and so forth after VS2010.
https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.prepare(v=vs.110).aspx
Which makes it pretty much useless... :laugh:
If you try this:
try
{
using (SqlConnection con = new SqlConnection(strConnect))
{
con.Open();
DataTable dt = new DataTable();
using (SqlCommand cmd = new SqlCommand("SELECT Column FROM TableThatDoesntExist ORDER BY Title ASC", con))
{
cmd.Prepare();
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
{
da.Fill(dt);
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

You'll get an exception at the DataAdapter.Fill, but not at Prepare.
OriginalGriff 4 days ago View
   
"it did not work" is one of the most useless error reports you can give - it tells us nothing. We can guess that it doesn't work because otherwise you wouldn't be asking about it, but we have no idea in what way it "didn't work".
Remember that we can't see your screen, access your HDD, or read your mind - we only get what you type to work with.
So perhaps you want to explain what happened that you didn't expect, or didn't happen that you did...
OriginalGriff 4 days ago View
   
No.
You Patient isn't a Form - it isn't anything that the user interacts with directly. It's a "storage area" for keeping related information together.
Think of how a doctor's surgery handles it's patients: each gets a folder which a patient number on it, and the folder contains the name, address, and medical history of one patient. And in a big room is a load of filing cabinets, each of which contains 1000 folders, each for a different patient.
When a patient goes to visit a doctor, someone goes to the room finds the right folder and gives it to the doctor to read.
The patient interacts with the doctor but isn't allowed anywhere near his folder! The doctor updates the folder with his latest analysis and procedures, and tells the patient what to do.

In this scenario, the Doctor is a Form, the folder is a Patient class instance, and the patient is a User.
When a new patient joins the surgery, he interacts with the receptionist to produce a new folder which can be given to the doctor. The receptionist is a "new patient form" in this case.

So you have a main form (doctor), new patient form (receptionist), both of which interact with a Patient class on behalf of the user.
Does that make sense?
OriginalGriff 5 days ago View
   
:laugh:
fnp is just a variable name! It's a variable that holds a Form - the "New Patient" form that your user enters data into.

It's not the variable holding a Intake class instance that I'm suggesting you throw away - it's the whole class. Replace it with a class that holds the whole of the information about a patient together, plus the properties and methods that operate on a patient.
If you like, think of a class as a "super-duper" struct in C, and a variable as a C pointer - it's very similar in many ways, but the system sorts out the dereferencing for you behind the scenes. There's a lot more to it, but it's good enough to start with.
Are you doing a C# course, or using a book? Please don't say you're trying to pick it up as you go along!
OriginalGriff 5 days ago View
   
Answer updated.
OriginalGriff 5 days ago View
   
That's complicated, because I don't know exactly what you are doing.
The problem is that you create a new instance of the Intake class in your Calculate method, but you don't "keep" it anywhere - so it is discarded when the method ends. You do keep the protein intake value to calculated (you store it in your TextBox) so you could use that, but it depends on what you are trying to do how you should really approach this.
Clearly you haven't been doing this long, but I don't know how much you have been taught - so it's really difficult to explain without adding to your confusion by introducing new concepts! :laugh:
So...
Do you know what an instance is? A class level variable? How do you show the user the other form, and where do you show it from?
OriginalGriff 5 days ago View
   
And I'm serious.
Talk to the gateway company: they will have technical support that are used to this.
If you get code from anywhere else it's you that will be responsible in law if the code does anything malicious at all.
Most of the people here are responsible professionals: but that doesn't mean that everyone here is, and when it comes to real money you cannot afford to be too trusting - particularly if you don't know what you are doing so can't spot the bad code...
OriginalGriff 5 days ago View
   
You're welcome!
OriginalGriff 5 days ago View
   
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.
So tell us what the error message is. Tell us which line the compiler doesn't like.
Help us to help you!
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 5 days ago View
   
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.
So what exactly do you mean by "chosen by me" and "the rest"? Perhaps if you share some sample data, and explain how you "chose" which should be in what order it might help?
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 5 days ago View
   
Why are you passing parameters to your SP if you aren't using them?
Are you sure that 1) the SP looks exactly like that? 2) The DB is the same one for both queries?
OriginalGriff 24-Jul-16 10:04am View
   
Well, the brute force and ignorance approach would be to set the focus to the "=" button when you end the other key handler methods.
OriginalGriff 24-Jul-16 10:02am View
   
What have you tried?
Where are you stuck?
What help do you need?
OriginalGriff 24-Jul-16 8:31am View
   
What does the debugger say is happening?
OriginalGriff 23-Jul-16 13:39pm View
   
You're welcome!
OriginalGriff 23-Jul-16 11:40am View
   
You're welcome!
OriginalGriff 23-Jul-16 10:49am View
   
That code doesn't have anything called "d15" - check that you have shown us the actual code being executed and that it compiles correctly. If it doesn't, then you may be running an old version of the code and looking at an error you have already fixed.
Assuming that it isn't, what does the debugger show as the line that generates the exception?
OriginalGriff 23-Jul-16 10:43am View
   
You can't do it without a Timer.
Windows applications (as opposed to console apps) don't work that way: the display isn't continually updated, it just looks like that!
What happens in Windows apps is that they work on something called a "message queue" (which the .NET framework converts into Events) - when you change the Text property of a label, it saves the new value and issues a "paint me" message to the form containing it. That goes into the message queue and when it is taken out of the queue the Paint Event gets generated and the actual control display is changed. But if your method doesn't return then the message queue is never examined and Paint events don't get generated. So your display never gets updated.
Use a Timer - it's the simplest way (if not the only, but I really don't want to start confusing you with Threading yet).
OriginalGriff 23-Jul-16 5:46am View
   
As I said: step back and think about it for a couple of minutes.
If you want to store multiple strings, what do you need to store them in?
If you want to output multiple values, where do you need to do the output?

This isn't difficult, not really - it just seems like it because you are trying to rush it instead of thinking first, then coding. Give it a try!
OriginalGriff 22-Jul-16 14:08pm View
   
It's a C style array of ten char values, called "string"
OriginalGriff 22-Jul-16 10:52am View
   
Tch! Youth of today...no patience at all.

I died in two world wars for the likes of you! Bring back National Insurance, that's what I say! Couple of years in a Building Society do 'em a world of good!
OriginalGriff 22-Jul-16 10:50am View
   
Shows how often I let exceptions go unhandled, doesn't it? :laugh:
OriginalGriff 22-Jul-16 8:34am View
   
Without some idea of what the code is doing?Not a whole lot we can do to help from just that, I'm afraid...
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 22-Jul-16 7:01am View
   
How are you binding it?
OriginalGriff 22-Jul-16 6:44am View
   
I get the same result with the Debug build EXE and the Release build EXE if I run them without VS loaded at all.
OriginalGriff 22-Jul-16 4:54am View
   
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.
So perhaps the relevant code fragments would help us?
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 22-Jul-16 4:53am View
   
What have you tried?
Where are you stuck?
What help do you need?
OriginalGriff 22-Jul-16 1:57am View
   
You're welcome!
OriginalGriff 21-Jul-16 16:12pm View
   
Of course I can't!
They all have different facilities: email, SQL, MySQL, disk space, bandwidth, up time, .... and I no idea what you might need.
So don't be so lazy and start looking - this could be important to you so you don't want to get it wrong... :laugh:
OriginalGriff 21-Jul-16 10:46am View
   
No, Primary Key just tells SQL which column you are going to access the table via most, so it should optimise indexes for that column. Every table should have a PK.
Whichever table is the master is the one to which all the other foreign keys refer.
OriginalGriff 21-Jul-16 10:05am View
   
Then think about what you are trying to do instead of just blindly following instructions!
Of course I don't know which table of yours holds the master reference and which one you set as foreign keys. So use the master table instead of Signup...
OriginalGriff 21-Jul-16 9:52am View
   
Good thought! :thumbsup:
OriginalGriff 21-Jul-16 9:48am View
   
Sorry, wrong database! Just remove the "*".
OriginalGriff 21-Jul-16 8:59am View
   
Use the debugger: follow the code through and see exactly what happens. I can't tell without running it because most of that is dependant on what looks to be a mouse location in an event handler! And that will depend on what data you are using - which I don't have. :laugh:
So use the debugger - it's not difficult at all!
OriginalGriff 21-Jul-16 8:25am View
   
Cascading deletes are dangerous, yes - but not half as bad as cascading deletes with LIKE! :laugh:
OriginalGriff 21-Jul-16 8:23am View
   
It's the LEFT JOIN that does it, rather than a SELECT ... FROM with multiple tables.
OriginalGriff 21-Jul-16 7:40am View
   
So add it...
LEFT JOIN Table2 b ON a.empid = b.empid
WHERE a.mngrid='mn1'
OriginalGriff 21-Jul-16 6:37am View
   
Use the debugger and look at exactly what you have in the various dictionaries. If you aren't adding them all to the right list(s) then you will get "funny" results. And I can't check the code you use to add and remove them!
OriginalGriff 21-Jul-16 6:01am View
   
We are. We are telling you that you need to use the debugger!
Yes, I could say: "it's this, and this" - but that doesn't help you with the next project. Which will be a lot more complex, and harder to debug.
Debugging code is a fact of life: the job is nowhere near done when you finish writing a bit of code. And if you can't learn to debug your code, you are going to get exactly nowhere because your code will never do what you want it to.
So learn how to debug for yourself on a trivial piece of code like this, and you can use the same skills to debug a 100,000 line monster because it's the same principles on a bigger scale.

What you are trying to do is get your driving licence by letting someone else do the driving during all the lessons while you watch a movie, and then expecting to get a job driving road trains!
OriginalGriff 21-Jul-16 5:56am View
   
So you haven't done anything at all yet?
OriginalGriff 21-Jul-16 5:10am View
   
Ok - that works, but it might not be the best way. Have you been introduced to classes yet? Do you know how to create a class?
OriginalGriff 21-Jul-16 4:33am View
   
How are you storing each candidate?
OriginalGriff 21-Jul-16 4:12am View
   
And?
What have you tried?
Where are you stuck?
What help do you need?
OriginalGriff 21-Jul-16 3:33am View
   
You're welcome!
OriginalGriff 20-Jul-16 12:52pm View
   
Your English is fine!
OriginalGriff 20-Jul-16 12:52pm View
   
Do an image backup weekly, but alternate between your two external drives - that way you minimise the loss if you do get random ware. And always disconnect the drive when the backup is finished!
The AOMEI backup allows you to restore the whole image and get whole whole system back, or load there image as a virtual drive and access individual files, which is very handy!
OriginalGriff 20-Jul-16 11:38am View
   
Ah! That just means a further index:

Staffs[1][1].Remove(listValue);
OriginalGriff 20-Jul-16 10:04am View
   
What have you tried?
Where are you stuck?
What help do you need?
OriginalGriff 20-Jul-16 9:19am View
   
Don't write your own - it's not the best way, trust me! Instead, look at something like this:

http://www.aomeitech.com/aomei-backupper.html

I use it: the free version is excellent, so good I paid my own money for the full one!
And you really, really don't want to do backups onto the same disk: that just means when you get a disk problem you lose the backup as well! And backup to SQL DB via a network will be painful, via the internet it will be horrifically slow. To backup, use a removable USB drive and disconnect it when you are finished (so that ransomware can't corrupt your backups as well).
OriginalGriff 20-Jul-16 9:11am View
   
You're welcome!
OriginalGriff 20-Jul-16 8:48am View
   
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 from - we get no background or context beyond that.
So explain what you mean by a "global exception", what environment you are working, and tell us what you have tried, and why it didn't work.
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 20-Jul-16 8:43am View
   
As I said, I wouldn't store it in a DB at all - it really isn't a good idea!
But...the first line reads a file into memory. So when you want to read the file... :laugh:
You can then use the code in the link to save it to the DB.
The second is to write it to a file - so you use it after the code in the link!

As for you second question: get it working to and from the DB first - then worry about anything else. But if you are using this to "hide" you video collection for some reason, then be aware that it won't hide it for more than a few seconds from anyone halfway competent!
OriginalGriff 20-Jul-16 6:28am View
   
Upvote for honesty! :laugh:
OriginalGriff 20-Jul-16 5:57am View
   
You're welcome!
OriginalGriff 19-Jul-16 16:29pm View
   
You're welcome!
OriginalGriff 19-Jul-16 13:59pm View
   
Don't try - resources are stored inside the assembly, so for each new HDD you'd have to produce a different EXE file!
OriginalGriff 19-Jul-16 12:20pm View
   
Then the Session is the way to go (or cookies, but they are stored on the user computer)
https://www.google.co.uk/search?q=usign+the+session+vb&oq=usign+the+session+vb&aqs=chrome..69i57.3357j0j7&sourceid=chrome&ie=UTF-8
Will give you everything you need.
OriginalGriff 19-Jul-16 11:53am View
   
Because Public does the same thing: it's an access modifier, it doesn't magically make it not require an instance.
There is something that does that: Shared - but that is very very dangerous in a website as it creates a single variable that is common to the whole app. But...many users of your site will share the same app and thus the same variable, so it may not contain what you think it should!
Seriously: use the Session.
OriginalGriff 19-Jul-16 11:26am View
   
This is an international site; we have members from everywhere.
OriginalGriff 19-Jul-16 5:38am View
   
I think he's trying to use a weakreference to tell him when a form is closed - and that means the FormClosed event.
OriginalGriff 19-Jul-16 5:36am View
   
Sorry - I should have explained more clearly - my mistake.
Dispose is called for a Form when it is closed, and it is responsible for shutting down the Message Loop, deallocating the Windows Handle, and such like resource cleanup.
But Dispose does not deallocate the heap memory for the class - only the Garbage Collector can do that - and it does not call up the Garbage Collector to start the deallocation. It just marks the instance as "disposed" so that the GC doesn't have to call it again when it does decide the instance memory can be released.
If Dispose caused deallocation, then anywhere that a *using* block was used woiuld be unpredictably slow:
using (SqlConnection con = new SqlConnection(strConnect))
{
con.Open();
using (SqlCommand cmd = new SqlCommand("SELECT Id, description FROM myTable", con))
{
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
int id = (int) reader["Id"];
string desc = (string) reader["description"];
Console.WriteLine("ID: {0}\n {1}", id, desc);
}
}
}
}
Would activate the GC three times! :laugh:
The GC is only called into action when a memory request is unable to be fulfilled, or it is explicitly invoked via GC.Collect.
OriginalGriff 18-Jul-16 5:59am View
   
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.
So explain exactly what you are trying to do, what your inputs are, and what output you expect!
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 17-Jul-16 10:44am View
   
Yeah - I'm guessing the DataSource isn't a DataTable (DataSet, List, or some other Collection) - but the debugger is the only way to be sure.
OriginalGriff 17-Jul-16 7:01am View
   
Yes. Yes we can.
Now, what have you tried?
Where are you stuck?
What help do you need?
OriginalGriff 17-Jul-16 6:00am View
   
How do you expect us to be able to help when we have no idea what your code looks like, much less what it does or how it does it?
OriginalGriff 16-Jul-16 14:01pm View
   
In what way do you think we could do that to cram 32,767 different values into the space for 16?
That would be like converting a bitmap of the Mona Lisa into an EGA image that was 16 pixels wide by 16 pixels high. It's going to look more like Marge Simpson than a da Vinci masterwork! :laugh:
OriginalGriff 16-Jul-16 8:21am View
   
I'm assuming because it affects the form the UC is embedded into, and that's a no-no from an OOPs POV.
OriginalGriff 16-Jul-16 5:02am View
   
Sorry - that doesn't make any sense without seeing your screen - which I can't do.
Remember, I only get to see exactly what you type!
So try again, and explain in simple steps exactly what happens and what is in the relevant variables when it does. In particular, look at the content of array[i] before you call Split each time.
OriginalGriff 16-Jul-16 3:56am View
   
Sorry?
That doesn't make any sense to me - 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, we don't get any of the context that you assume about the project.
So explain where UserControls fit into this exactly and why they cause you a problem.
OriginalGriff 16-Jul-16 1:56am View
   
Don't "bump" your question, it's rude and doesn't help you get an answer - quite the reverse, it annoys people so they are less likely to help you.
Add useful information by all means, but trivial, irrelevant additions just to move it to the top of the unanswered list is "bumping" and that's not a good idea.
OriginalGriff 15-Jul-16 8:46am View
   
Well no...it isn't.
Look at the first section of code in your original question, and the first function definition defines "from":

$('[ID*=search_data]').on('click', function () {
var from = $('[ID*=fromdate]').val();

The second lacks the definition, but does have the usage:

$(function () {
$('[ID*=search_data]').on('click', function () {
var fromdate = $('[ID*=fromdate]').val();
var todate = $('[ID*=todate]').val();
var regiondrop = $('[ID*=regiondrop] option:selected')[0].value;
var GridView1 = $('[ID*=GridView1]');
var obj = {};
obj.fdate = from;

Shouldn't that last line be:

obj.fdate = fromdate;
OriginalGriff 15-Jul-16 8:24am View
   
And what happens?
OriginalGriff 15-Jul-16 7:46am View
   
You're welcome!
OriginalGriff 15-Jul-16 7:12am View
   
So that should work directly into the GridView.DataSource - what happens when you try?
OriginalGriff 15-Jul-16 5:09am View
   
Returning an anonymous type from Linq as the generic for the List would make that difficult - if you are doing that, then use the link I gave to convert it to a DataTable and return that so you can set your GridView.
But if you create a List of a defined internal class in your Linq, then just use that instead - it saves time, memory, and effort!
OriginalGriff 15-Jul-16 4:35am View
   
What have you tried?
Where are you stuck?
What help do you need?
OriginalGriff 15-Jul-16 4:12am View
   
You're welcome!
OriginalGriff 15-Jul-16 3:47am View
   
If all you are trying to do is set the DataSource of a GridView then you don't need a DataSet or DataTable at all - you can use the List directly, provided your class holds the values you are trying to display as properties rather than fields.
OriginalGriff 15-Jul-16 1:16am View
   
Repost: deleted.
OriginalGriff 14-Jul-16 15:56pm View
   
"Very noob mistake" - and one we all make even now... :)
OriginalGriff 14-Jul-16 10:59am View
   
So make the method static if you are calling it direct from main...
It does seem that you are trying to run before you can walk - you should probably know some of this stuff if you've been on your course for a couple of weeks.
OriginalGriff 14-Jul-16 10:50am View
   
You are kidding me - it's one method! All you have to do is call CreateLink and pass it the parameters...
The rest of it is just coordination with external structures, hence the ComImport decoration...
OriginalGriff 14-Jul-16 8:36am View
   
Sorry? That doesn't make any sense to me.
Remember that we can't see your screen, access your HDD, or read your mind - we only get to work with exactly what you type.
So that sentence without the context you know around it is pretty meaningless. Please try to explain it in more detail.
OriginalGriff 14-Jul-16 6:26am View
   
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.
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 13-Jul-16 10:11am View
   
Without seeing the relevant code fragments?
Not a lot we can do to help.
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 13-Jul-16 10:03am View
   
You're welcome!
OriginalGriff 13-Jul-16 8:02am View
   
So what is your SP expecting?
And you do realize that you are committing a code crime here?
http://www.commitstrip.com/wp-content/uploads/2013/09/Strips-Erreur-au-pilori-001-650-finalenglish.jpg
OriginalGriff 13-Jul-16 7:48am View
   
What have you tried?
Where are you stuck?
What help do you need?
OriginalGriff 13-Jul-16 5:42am View
   
You're welcome!
OriginalGriff 13-Jul-16 4:27am View
   
Repost: deleted.
OriginalGriff 13-Jul-16 3:55am View
   
We don't know.
It all depends on the rest of your code: if you call this method from a button click handler or similar then it's almost certainly on the UI thread, so Invoking will do nothing. So "no".
If your code already uses threading and the calling method is on a non-ui thread, then it's "yes".
But we don't have access to your code, so we can't tell.
Which leads us right back to the short answer: "maybe".
OriginalGriff 12-Jul-16 6:36am View
   
In your case, none!
In some of our members case's 100% ...
Me? I'm about 10% spam due to banging on about AOMEI Backuper :laugh:
OriginalGriff 12-Jul-16 6:14am View
   
Not easy to do - you could try this:
http://stackoverflow.com/questions/18076673/detect-recursive-calls-in-c-sharp-code
But I haven't tried it.
OriginalGriff 12-Jul-16 4:55am View
   
You're welcome!
OriginalGriff 12-Jul-16 4:38am View
   
When you are given sample code, you are expected to think about what you are doing before you modify it...
Remember back to your C# course: basic strings.
Two types of string, yes?
"hello \"Griff\" can you read this?"
And
@"hello ""Griff"" can you read this?"
The "@" at the front of a string disables the "backslash" escape character within that string.
So why are you trying to use it in front of an open bracket?
OriginalGriff 11-Jul-16 12:08pm View
   
You're welcome!
OriginalGriff 11-Jul-16 11:14am View
   
That's right - you set it as an IDENTITY field when you create the DB and then when you do an INSERT operation, SQL will create a unique value for that field for you.
You can combine the INSERT with a SELECT @@IDENTITY or SELECT IDENTITY_SCOPE() to return the created value to your app if you need it.
OriginalGriff 11-Jul-16 9:55am View
   
Sorry, but...if you have to ask, then you need to learn everything!
Seriously, find a couple of good books on the subject and start reading - there is a huge amount to learn.
OriginalGriff 11-Jul-16 4:32am View
   
Just saying "it don't work" tells us nothing: and we can't test it because we don't have your data and we don't know what you are trying to do.
So ... 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.
Tell us what it does that you didn't expect, or didn't do that you did. Tell us any error messages, show us sample input and output data.
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 11-Jul-16 4:03am View
   
You're welcome!
OriginalGriff 11-Jul-16 3:33am View
   
Reason for my vote of 1 \n Plagiarised.
OriginalGriff 11-Jul-16 2:05am View
   
Copy and paste *exactly* what you tried to compile: include a couple of lines either side for context.
OriginalGriff 10-Jul-16 14:06pm View
   
Check you typed it correctly?
OriginalGriff 10-Jul-16 11:03am View
   
So what happens when you run them in the debugger?
OriginalGriff 10-Jul-16 7:48am View
   
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.
And I for one can't make head or tail of what you are trying to do, much less what problem you are having doing it!
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 10-Jul-16 6:53am View
   
void MyFunction(int id, char** pstrName)
{
...
}
...
MyFunction(t1.id, &(t1.name));

Or just pass a pointer to the whole struct:
void MyFunction(struct test* data)
{
...
}
...
MyFunction(&t1);
OriginalGriff 10-Jul-16 3:26am View
   
You're welcome!
OriginalGriff 9-Jul-16 7:43am View
   
You'd be surprised!
If you are doing something that is decidedly odd - and you are - then that's very often a sign that you are doing something very, very wrong and going down the wrong route. Hence the "Just because you *cn* do something..." comment.
Remember, we don't know why you are trying to do this - so we can't say "that's silly, do it like this instead and your life will be a whole lot easier". All we can do is say "think before you do this - it isn't something you probably need to do!"
OriginalGriff 9-Jul-16 3:40am View
   
Repost: deleted.
If I was you, I'd stop posting the same question over and over again - you are going to get tagged as "abusive" fairly shortly and that will get you banned from the site...
OriginalGriff 9-Jul-16 3:36am View
   
I don't think a folder is a fully qualified URI unless it is terminated with the slash / backslash - without that it's a file reference rather than a folder.
And your IP address doesn't look right either - a V4 IP has four segments, while yours has five, and a V6 would use colons instead of dots.
The port number shouldn't be separated from the IP by a slash either:
http:\\127.0.0.1:80\The folder name\
may be worth trying.
OriginalGriff 9-Jul-16 3:17am View
   
Repost: deleted.
OriginalGriff 9-Jul-16 2:48am View
   
What have you tried?
Where are you stuck?
What help do you need?
OriginalGriff 9-Jul-16 2:38am View
   
:laugh:
You've done the *first part* of the homework: you've written the code you think does the job.
Now you've tested it and it fails - so the second part of the job it to find out why and fix the problem.
It's like trying to do anything: make a paper plane for example. Folding paper so it looks sleek and has wings is easy, but getting it to fly in a straight line means changing it, tweaking it, throwing-it-away-and-starting-again!
Developing code is the same: it isn't finished until it works.
Think about your other homework: writing an essay isn't over when you hammer out a rough draft - you have to polish it, tweak it, add bits, take bits away before you end up with something you can submit. If you don't, you get a poor grade.
So give it a try - debugging is the fun bit!
OriginalGriff 9-Jul-16 2:18am View
   
You mean performance wise?
Probably - Regex isn't particularly efficient, but you'd probably need to do some performance tests to check the efficiency of the various possibilities.
There is a tip I wrote on a similar subject a few years ago:
http://www.codeproject.com/Tips/312312/Counting-Lines-in-a-String
Which does performance calculations for the various ways of checking newlines - which is a similar problem in many ways - and it gave some surprising results.
It's in C#, not VB, but it's pretty easy to understand (and has an "executive summary" which doesn't need code familiarity) and may be worth a read. (and you can translate between the two languages with
http://converter.telerik.com/
anyway).
Ultimately, you'll need to write a few different pieces of code and use Stopwatch to compare them to know for sure.
OriginalGriff 8-Jul-16 13:56pm View
   
If you want to create database tables then you *have to tell us that*!
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.
Creating tables from a datatable is unusual - it's not a "normal" thing to do with a DB as Tables are generally finely crafted and well thought out (getting the design wrong can make your applications that use it really difficult to code and maintain).
But... it's possible:
http://stackoverflow.com/questions/1348712/creating-a-sql-server-table-from-a-c-sharp-datatable

However. Just because you *can* do something doesn't mean your *should* do it. I'd think long and hard about what you are going to end up with and what you are goign to use it for before going down this route if I was you.
OriginalGriff 8-Jul-16 8:23am View
   
You're welcome!
OriginalGriff 8-Jul-16 7:46am View
   
Don't use ParseExact - use TryParseExact instead.
ParseExact will throw an exception if there is a problem, TryParseExact tells you what happened instead, allowing you to inform the user of a problem.
OriginalGriff 8-Jul-16 7:21am View
   
Because Form3 tells Form1 that, not Form2! Form2 is closed by that stage, remember? So how could it tell Form1 anything?

Form1 creates Form2 and subscribes to the "SearchResults" event. It then shows Form2.
Form2 signals the event, and closes.
Form1 gets the event, and in the handler it creates Form3, passes it the search results from Form2, and subscribes to it's "ItemSelected" event. It then shows Form3.
Form3 waits for the user, and signals the "ItemSelected". Form1 gets the event, and in the handler it queries Form3 for the item.
See what I mean?
OriginalGriff 8-Jul-16 7:12am View
   
If it's null, it isn't DBNull.Value - that is a very different thing.
So check for null instead:
amount = smsMessageTransactionDetailsProcessing.Amount == null ? "0" : smsMessageTransactionDetailsProcessing.Amount.ToString();
OriginalGriff 8-Jul-16 6:14am View
   
Yes!
OriginalGriff 8-Jul-16 5:47am View
   
That's the wrong way to do it.
Form1 doesn't know about Form3 - and nor should it if Form2 opens the window.
And if Form2 closes... that's bad design!

Instead, create a Results event in Form2 which Form1 handles.
Form2 signals the event and either closes or not as it chooses.
The Form1 handles the event and in the handler retrieves the info from Form2, creates Form3 and passes it the data it needs.
That way, the Search form doesn't need to know what is done with the results, and the Main form doesn't need to know how the Results form is displaying it.
OriginalGriff 8-Jul-16 5:04am View
   
Doesn't mean that it's the same format as the server system expects: you need to validate it and report any problems rather than proceeding blindly as if it will always be correct. Which it clearly isn't, or you wouldn't get the error...
OriginalGriff 7-Jul-16 13:59pm View
   
You're welcome!
OriginalGriff 7-Jul-16 13:58pm View
   
You're welcome!
OriginalGriff 7-Jul-16 13:08pm View
   
"I have another question please if I want to create a button where when the mouse hover it the password is shown. How could I do it in c sharp ?"
Use a ToolTip:
https://msdn.microsoft.com/en-us/library/aa288412%28v=vs.71%29.aspx?f=255&MSPPError=-2147217396
OriginalGriff 7-Jul-16 12:23pm View
   
Well, there is the "panes" technique that Visual Studio uses - that's pretty effective, and it also "scales well" to different resolutions. Floating / docking makes it work well, and also keeps the the user happy as they can customise it to their preference.
Then there is the "multiple top-level windows" approach, where the user is free to locate the windows where he wants (and they save their positions for next time).
Or there are tabbed pages, or ... loads of different ways, really - but what you want to use will depend on what the app does, and why it's currently an MDI design.
Think about it: can you think of any new app from the last ten years that used MDI? I can't...and WPF doesn't even support it!
OriginalGriff 7-Jul-16 9:58am View
   
Try to explain in more detail exactly what you are trying to do - we get no context for your question except exactly what you type - we can't see your screen!
If this is a login screen, then that is handled one way; if it's something else then we need to know details.
OriginalGriff 7-Jul-16 9:41am View
   
Yes - but... if f1 is the main form then the application will close when it does, so f2 will also be closed.
A better way is to have f2 be the main form, and use a splash screen as shown in the links.
OriginalGriff 7-Jul-16 6:14am View
   
Urgency deleted: It may be urgent to you, but it isn't to us. All that your stressing the urgency does is to make us think you have left it too late, and want us to do it for you. This annoys some people, and can slow a response.
OriginalGriff 7-Jul-16 6:10am View
   
You're welcome!
As an idea for the future, please try to give us all the info you can as it helps us give you a better answer instead of having to guess what you mean.

Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work from!
OriginalGriff 7-Jul-16 4:29am View
   
Do not reopen old questions to post rubbish - it will be taken as abuse and you will be banned.
Take this as your one-and-only warning on the subject...
OriginalGriff 7-Jul-16 3:49am View
   
"My program not working" is not a helpful error description.
What is it doing that you didn't expect, or not doing that you did?
Any error messages?
What did you do to make it produce the output?
What help do you need?
OriginalGriff 6-Jul-16 13:56pm View
   
Just because you *can* do something... :laugh:
OriginalGriff 6-Jul-16 9:46am View
   
Sorry, but I can't give you a specific example for your situation - I don't have access to the rest of your code!

Find where you display the Form2 and look at what you are doing there.
OriginalGriff 6-Jul-16 3:07am View
   
What code do you need?
You know how to handle an event, and how to add a handler, yes?
And you know how to create an event, I assume?
OriginalGriff 5-Jul-16 17:19pm View
   
Edit it and you'll see - it's easier than trying to explain!
There's a "encode" option on the paste menu as well...
OriginalGriff 5-Jul-16 11:28am View
   
And?
What have you tried?
Where are you stuck?
What help do you need?
OriginalGriff 5-Jul-16 5:47am View
   
No, the "?" says "zero or one" of the preceding character.
Get a copy of Expresso:

http://www.ultrapico.com/Expresso.htm

It's free, and it examines and generates Regular expressions.
OriginalGriff 5-Jul-16 5:13am View
   
We would need to see the code fragments you used to save and retrieve the data - it looks like your code is "normalizing" data for HTML presentation.
OriginalGriff 5-Jul-16 4:05am View
   
Repost (again): deleted.
Keep this up, and we'll start counting it as abuse...
OriginalGriff 5-Jul-16 3:30am View
   
You're welcome!
OriginalGriff 5-Jul-16 2:54am View
   
You're welcome!
OriginalGriff 5-Jul-16 2:43am View
   
Repost: deleted.
OriginalGriff 4-Jul-16 12:26pm View
   
Go for it!
Get used to creating and handling events - they are really simple, but they make the whole of .NET work.
I use them so often that I wrote this:

http://www.codeproject.com/Articles/400287/A-simple-code-snippet-to-add-an-event

Which means that I add an event to a class by typing "evh" and pressing TAB twice!
OriginalGriff 4-Jul-16 12:04pm View
   
Of course it will!
In your case the information you are transferring is "the user asked for Form3", which just needs the event - you don't need a property in this case.

Think about it: it's the same as a TextBox signaling the TextChanged event - it doesn't care what your form does with that, it just indicates it happened.
OriginalGriff 4-Jul-16 11:42am View
   
None that make sense within the OOPs environment - it's all about separation of concerns.
It's really not difficult - creating an event is only a few lines of code, and signaling it is only one line! And the link includes the code to do all of that.
OriginalGriff 4-Jul-16 10:34am View
   
The little tinkers! :laugh:
Try this:
https://github.com/dbarros/WindowsAPICodePack
OriginalGriff 4-Jul-16 9:24am View
   
I could dump most the rest if I did that! :laugh:
OriginalGriff 4-Jul-16 8:53am View
   
So, you're suggesting:
<span style="font-family: verdana;font-size:200px;color:red">RTFM</span>
:laugh:
OriginalGriff 4-Jul-16 8:40am View
   
Snap! :laugh:
And then he asks me for a code example that I already gave... :doh:
OriginalGriff 4-Jul-16 8:39am View
   
Um ... did you read what I wrote?
OriginalGriff 4-Jul-16 6:53am View
   
You're welcome!
OriginalGriff 4-Jul-16 6:52am View
   
You use a parameter for two reasons:
1) So that you can send the DateTime value directly. The alternative is to convert it to a string, but then you leave room for SQL to misinterpret the value: what date is 01/02/03? It could be US: 2nd Jan 2003, Europe: 1st Feb 2013, Japan / ISO 3rd Feb 2001 ... getting it wrong can really screw up your database!
2) Because it's good practice: you should *NEVER* concatenate strings to form an SQL command, because it can leave you wide open to something called SQL Injection which lets users damage or destroy your database just by typing in text boxes. And it's really, really easy for them to do:
https://xkcd.com/327/
Read it, and don't assume it's just a joke.
Get in the habit of always using parameters and you won't have a problem - it's too easy to get into bad habits and they are hard to break.
OriginalGriff 4-Jul-16 5:12am View
   
Please do not post "private" emails requesting help: this area (Quick Answers) is the right place for it. Sending me (or any other member) a "private email" sends them your email address and means the question is not visible to other members, who may be able to answer, or who have the same problem.
We do not generally answer individual questions, and most people (like myself) do not give out our email addresses that happily! (I get between several hundred emails every day already, and don't need any more! :laugh: )
OriginalGriff 4-Jul-16 5:03am View
   
What do you want to know?
OriginalGriff 4-Jul-16 5:03am View
   
You're welcome!
OriginalGriff 4-Jul-16 4:33am View
   
Answer updated
OriginalGriff 3-Jul-16 13:21pm View
   
What happens if you add a negative number?
int x =42;
x += -3;
Console.WriteLine(x);

Try it and see...
OriginalGriff 3-Jul-16 9:41am View
   
You're welcome!
Just remember to always use TryParse to check that the user typed correctly, and then use the converted value from then on. You just can't trust users to type accurately (or me, for that matter! :laugh: )
OriginalGriff 3-Jul-16 9:29am View
   
Just

cmd.Parameters.AddWithValue("@ProductWeight",userInput);

Always pass that actual value to SQL via a parameter, never convert it to a string first! If you convert it, something has to convert it back again and that's where problem start to creep back in. So remove the ToString from all your parameters.
And remember: C# is case sensitive, so ToString is not the same as tostring - the first is correct, the second is a compiler error!
OriginalGriff 3-Jul-16 9:15am View
   
What more detail do you need? You already have code to store values in SQL correctly...
OriginalGriff 3-Jul-16 9:14am View
   
Answer updated.
OriginalGriff 3-Jul-16 9:03am View
   
You're welcome!
OriginalGriff 2-Jul-16 6:11am View
   
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.
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 2-Jul-16 3:59am View
   
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.
So without some kind of context as to what "lab 3" is, or what you are trying to do we cannot help you.
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 1-Jul-16 10:37am View
   
You're welcome!
OriginalGriff 1-Jul-16 7:33am View
   
And your question is?
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.
Use the "Improve question" widget to edit your question and provide better information.
OriginalGriff 1-Jul-16 6:27am View
   
Depends on the movie, depends on the T&C's under which it is sold.
What you are trying to do is strictly against the T&C's you agreed to with iTunes:

"You agree that the iTunes Service and certain iTunes Products include security technology that limits your use of iTunes Products and that, whether or not iTunes Products are limited by security technology, you shall use iTunes Products in compliance with the applicable usage rules established by Apple and its licensors (“Usage Rules”), and that any other use of the iTunes Products may constitute a copyright infringement. Any security technology is an inseparable part of the iTunes Products."
"You agree not to violate, circumvent, reverse-engineer, decompile, disassemble, or otherwise tamper with any of the security technology related to such Usage Rules for any reason—or to attempt or assist another person to do so."
Plus a whole heap of other legalese...

And you should bear in mind that Apple are a notoriously litigious company! :laugh:
OriginalGriff 1-Jul-16 5:42am View
   
Copyright violation isn't "gentle" either: and as I said, this is a site for professional developers. That means that most of use in one way or another make money from producing software, or writing about producing software - and if people evade the protection on what we produce then potentially we don't get paid!
Hence we don't get involved in that in any way.
OriginalGriff 1-Jul-16 5:30am View
   
I'm not generalising from your question that you are stealing anything: a video with DRM has conditions, and removing the DRM violates those conditions regardless of why you are doing it. We don't assist with that kind of thing!
OriginalGriff 1-Jul-16 5:11am View
   
"VS is not for iOS app development"
You sure?
VS supports Xamarin Forms, which does very much work on iOS, Android, UWP, ...
OriginalGriff 1-Jul-16 2:55am View
   
Faith is a wonderful thing. But...it isn't the answer to everything.
You have to be aware that there are malicious people out there, who (through faith, or greed, or both) will happily try to get you to install their apps. Some of these guys target hospitals for elephants sake!
Now, I'm pretty solidly backed up, so if I ran it and it included ransomware I'd reload from my last backup and lose a few hours work. But...it'd take me half a day to do it.
By all means have faith - but back it up with sensible precautions!

"To say "we don't know you" is also cold, I am a member of CodeProject"
So are 12,000,000 others - and I know for a fact that some of those are malicious! You should *see* some of the posts that try to get in here. Or rather, you shouldn't - because volunteers like me try damn hard to keep them out!

In summary: protect yourself. Don't visit random sites, don't run random applications, do backup often and keep them offline. Otherwise, it's not a case of "if" you are going to have problems, it's "when".
OriginalGriff 30-Jun-16 14:38pm View
   
I don't think it's my end: kaspersky says no problem, and an inspection of the element says it's a standard google link:

https://www.google.co.uk/search?
q=calculate+speed+of+accelerating+object&
oq=calculate+speed+of+accelerating+object&
aqs=chrome..69i57j69i60&
sourceid=chrome&
ie=UTF-8"
OriginalGriff 30-Jun-16 14:06pm View
   
Without seeing the code you are using to encrypt and decrypt, there really isn't anything we can do to help: we have no idea what you are doing, so we have even less idea what you are doing wrong!
Try posting the relevant code fragments, and maybe it'll help.
Use the "Improve question" widget to edit your question and provide better information.

Advertise | Privacy | Mobile
Web02 | 2.8.160730.1 | Last Updated 1 Jan 1900
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid