15,895,256 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by HKHerron (Top 46 by date)
HKHerron
4-Sep-17 15:10pm
View
I Agree, I did state that this is not a secure approach.
However, I did mention using a Server-Side solution that would preform this function on the server instead, then reply back to the application if the keycode is valid or not.
I do have a couple of question for you though (Nothing to do with security)
How are you planning to maintain the database?
Are you going to add a new keycode every time you give out another copy?
What type of web-server are you running? Is it Public?
HKHerron
3-Sep-17 18:25pm
View
OK, there are some things you need to change for it to work correctly.
For example, the namespace should match your application.
HKHerron
3-Sep-17 17:14pm
View
There are several different ways you can handle the connection string.
Unfortunately, it is required to connect to any MySql database.
The text file was just a SIMPLE way to demonstrate.
I use the Text file version, because I use this in several applications and they connect to different servers. This way I can use the same code, and the only thing that changes is my DBConfig file. This is not considered Hard Coded, as it loads the information from the DBConfig file each time the application is ran. And yes, this is not very secure. However, to make the text file more secure, you could encrypt the text file. Then Decrypt in code to read the information.
You could also make it part of the Install application, hard code it in to the Initialize() method, then have it saved anywhere, and in any form. Once you application is complied, it is a lot harder to find the information.
One other way would be to create a Web App that does the MySql side of things, so that the connection string is actually on the web server and not in your code.
for example, write a web page:
http://www.mysite.com/CheckKeyCode?a1b2c3d4e5f6g7h8i9j10k11
Have it do the same work that in my code, then return a blank page with either the work true or false.
We then change my code to run an httprequest with the keycode entered, then read the response. Then perform actions based on the True or False reply.
One last thing, I forgot to mention, create a different user for the database to use other than your main account or the Admin account. Then only give the user rights to Query and Update.
HKHerron
10-Mar-16 16:02pm
View
PHP with MySQL is what I would suggest. However, It appears you need to learn more about coding languages and what their abilities are. Also, you could down load an open source project, and study the code.
HKHerron
31-Dec-15 16:47pm
View
You need to submit more code here for us to evaluate.
We can not solve your issue from what you have presented.
HKHerron
12-Aug-15 14:15pm
View
Can you show us a sample of what the string "output" would be? Line breaks in a Command Line are different than that in a list box.
HKHerron
23-Jul-15 9:47am
View
Please show us your code.
HKHerron
28-May-15 9:06am
View
1st, Thank you Sascha for your explanations and examples.
This makes the most sense to me.
Not sure if this would matter, but I should explain that there may be (say) 6 different Device objects. But they all use Service1, Service2 and Service3.
The Device objects are found through a UPnP broadcast that returns a list containing the url to each devices description.xml file. Each Device object is then populated according to the information found in the description file. This is where the services are found for that device.
Since all my devices use the same services, maybe I should just consider NOT making the Services even part of the Device object at all, but stand alone classes.
Then I could use something like: Service2.executethis(Device, "VolumeUp");
HKHerron
28-May-15 8:54am
View
Thank you Sergey Alexandrovich Kryukov for your explanation and response. +5
I am selecting Solution 2 as the accepted answer as it expands on your thoughts, while providing the best explanations, alternatives and options.
HKHerron
15-Apr-15 13:09pm
View
Not sure, but don't you need to specify the size of the rectangle?
Like this:
RadioCheckField ckbx = new RadioCheckField(writer, new Rectangle(20, 20), fieldname, "Yes");
HKHerron
24-Mar-15 19:56pm
View
Your issue is not in the error, but in Your code that caused it.
HKHerron
14-Mar-15 16:12pm
View
Look in to using a VLC library here: http://www.videolan.org/vlc/index.html
HKHerron
14-Mar-15 16:09pm
View
What are your 3rd party libraries compiled as? (x86, x64)
HKHerron
5-Mar-15 15:26pm
View
Actually, it was more @OriginalGriff code.
HKHerron
5-Mar-15 15:03pm
View
No, not mine, you used your code!
HKHerron
5-Mar-15 15:02pm
View
Try looking at this: http://www.codeproject.com/Articles/54645/WPF-ListView-which-can-do-Sorting-Filtering-Totals
HKHerron
5-Mar-15 14:55pm
View
Great, you should select it as your Solution!
HKHerron
5-Mar-15 14:47pm
View
It works for me!
You need to change this line:
Console.WriteLine(" Order #(), Quantity ordered ()",orderNum, quantity);
to this:
Console.WriteLine(" Order #{0}, Quantity ordered {1}",orderNum, quantity);
HKHerron
5-Mar-15 14:10pm
View
That's because your code still doesn't return any data beck to main. Look at solution 5, or Yes, you can do it like this, but it changes your classes to public!
using System;
public class DebugEight1
{
public static int orderNum = 0;
public static int quantity = 0;
public static void Main()
{
double total;
const double PRICE_EACH = 3.99;
DebugEight1.GetData();
total = quantity * PRICE_EACH;
Console.WriteLine(" Order #{0}, Quantity ordered = {1}", orderNum, quantity);
Console.WriteLine("Total is {0}", total.ToString("C"));
Console.WriteLine("=================================");
Console.WriteLine("Hit key to quit:");
Console.ReadKey();
}
public static void GetData()
{
String s1, s2;
Console.Write("Enter order number ");
s1 = Console.ReadLine();
Console.Write("Enter quantity ");
s2 = Console.ReadLine();
orderNum = Convert.ToInt32(s1);
quantity = Convert.ToInt32(s2);
}
Post your new code in a comment, or you can update your first post!
HKHerron
5-Mar-15 14:01pm
View
Your code creates an error in the line: GetData(orderNum, quantity);
"Use of unassigned local variable" - This is what we were asking for!
This is because your variables: orderNum and quantity are null!
Change this line: int orderNum, quantity;
to this: int orderNum=0, quantity=0;
HKHerron
5-Mar-15 13:53pm
View
OK, for starters, your code wont work because your GetData method does not return any information back to the Main method. Unless declared properly, variable declared in methods are not accessible to other methods. By using a class, you can pass this information between methods!
HKHerron
5-Mar-15 13:48pm
View
This is your code. All I did was fix it!
HKHerron
5-Mar-15 10:31am
View
As I mentioned, these are not my code, but some examples I found for you. This also seems to be a big issue for other users too. It's not really your code, but a bug when trying to integrate with your crystal report class. Crystal reports print from the "Default" printer by design of their software. Over-riding is possible but may not be the way you intend it to be.
I would start looking at Crystal Report forums, and ask you question there and see if any other users have found a solution to this. As I mentioned, it's not really a C# question, but more of a Crystal Reports question.
HKHerron
4-Mar-15 13:20pm
View
Not sure what you mean by "I have tried to write System.Windows.Forms, its not coming."
In VS, under your project references, add a reference to System.Windows.Forms. It's not coming up because you do not have a reference to this library. Which is where access to the PrintDialog is located.
Also here is another example I found out there:
try
{
using (PrintDialog printDialog = new PrintDialog())
{
ReportPrintDocument rp = new ReportPrintDocument(rvPermit.ServerReport);
Form currentForm = new Form();
currentForm.Show();
currentForm.Activate();
currentForm.TopMost = true;
currentForm.Focus();
currentForm.Visible = false;
if (printDialog.ShowDialog(currentForm) == DialogResult.OK)
{
if (PrintReport != null)
PrintReport(this, e);
rp.PrinterSettings = printDialog.PrinterSettings;
rp.Print();
}
currentForm.Close();
}
}
catch (Exception)
{
// Prevent any error while calling the printer dialog
}
HKHerron
3-Mar-15 16:02pm
View
Show us your code that attempts to open the connection!
HKHerron
3-Mar-15 14:24pm
View
Huh???
OH.. OK like this:
string name;
if(name == "Structure")
{
Console.Writeline("Yep, sure is!");
}
else
{
Console.Writeline("Nope, not structure name!");
}
LOL :)
HKHerron
3-Mar-15 12:55pm
View
Are the servers on your Local LAN, or internet?
Do you have any better idea of what the IP Addresses are?
Your starting at 100.100.0.0, but how many IP addresses do you need to go through to find the next one? or Do you know the IP Addresses of the server?
Since FTP servers use a particular Port, I would suggest possibly using a C# Port scanner on the IP address range and FTP port you are using (2222). You really don't even have to login or any thing, just see if it responds. Any response from one would mean that the server is ONLINE.
However, depending on the number of IP addresses it would need to go through, this could be a long process....
100.100.0.0 - 100.100.0.255 is a total of 256 IP address to search through.
100.100.0.0 - 100.100.255.255 is a total of 65,025 IP address to search through.
HKHerron
2-Mar-15 14:10pm
View
Deleted
Take a look here: http://www.aspsnippets.com/Articles/Display-image-from-database-in-Image-control-without-using-Generic-Handler-in-ASPNet.aspx it looks like a good starting point.
HKHerron
2-Mar-15 14:06pm
View
Why wouldn't you just use: public string cmb {get; set;}
HKHerron
1-Mar-15 18:43pm
View
For starters, most prices and totals are not an INT. they are a Double. When you convert to INT, it will round the cents up. So 1.75 = 2 and 24.95 = 25.
HKHerron
1-Mar-15 12:09pm
View
This will count spaces as a character!
HKHerron
1-Mar-15 10:18am
View
Does your application use any 3rd party libraries or API's?
When you build the project, are there any warnings or errors reported?
HKHerron
28-Feb-15 20:35pm
View
Your answer is the same as the console question that has already been answered.
HKHerron
28-Feb-15 14:01pm
View
We just worked on this as a console app. You need to do your own homework!
HKHerron
28-Feb-15 13:58pm
View
Is your question how to store data in a data base, or is it how to get the Longitude and Latitude from a MAP? I ask this because, storing the information in a database is just like any other data, as @Mehdi stated. If you are wondering what data type to use for it, I would suggest you just store is as a string. Then manipulate or covert as needed. Hope this helps you.
HKHerron
28-Feb-15 10:32am
View
OH, WOW. 100-1000 is a large range.
Did you try stepping through it in debug to see if the file.filename is actually changing through each file found? You can also add a line with int x = Files.Count(); and see how many files are found.
HKHerron
27-Feb-15 21:05pm
View
How many .jpg files are in c:\images?
HKHerron
27-Feb-15 16:33pm
View
Devices that use the SOAP service usually have a Description file that will start you on your way to finding all the methods available. In many cases this file can be retrieved by going to the devices IP address and including the file name. For example: 192.168.1.100/description. However, some devices use a different name like DMR.XML. Try looking at this library to help you find UPnP services and methods: http://www.managedupnp.codeplex.com
HKHerron
26-Feb-15 15:22pm
View
You really need to provide some more information here. Show us the code your trying to use.
HKHerron
25-Feb-15 16:16pm
View
I think he is trying to prevent 2 people from editing the same record at the same time??
HKHerron
24-Feb-15 13:43pm
View
I totally agree, but was not considering other data being entered as he is defensively not ready to handle validating input yet! LOL
HKHerron
24-Feb-15 13:35pm
View
Wow, can't believe I overlook 2 stupid things.
It should be ReadLine() just in case they enter a 2 digit number. This is why you were asking what if they entered **50**. or even **11** for that matter.
I have updated my solution.
HKHerron
24-Feb-15 13:26pm
View
Thanks for the catch on that @Andreas. My over-site...
This should work though:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Multiplication
{
class Program
{
static void Main(string[] args)
{
int number;
Console.Write("Please enter a number: ");
var x = Console.Read();
number = Convert.ToInt32(x);
MultiplicationTable(number);
}
private static void MultiplicationTable(int num)
{
int[] times = { 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int answer;
foreach(int tnum in times)
{
answer = num * tnum;
Console.Write("The product of " + num + " x " + tnum + " = " + answer);
}
}
}
}
HKHerron
24-Feb-15 13:15pm
View
What are you entering???
HKHerron
24-Feb-15 13:13pm
View
tnum is each value in the array.
so during the loop, tnum will = 2 the first time, 3 the second time 4 the 3rd time and so on.
HKHerron
24-Feb-15 13:12pm
View
Well, if you enter 50, then YES it going to do 50x2, 50x3, 50x4 and so on.
So the output should be:
100
150
200
250
300
350
However if you enter 2, it will be 2x2, 2x3,2x4,2x5 and will return
4
6
8
10
12
If you enter 1, then it will be 1x2, 1x3, 1x4 and will return
2
3
4
5.
Show More