|
Never, ever, accept code from a insecure website to handle anything to do with real money.
You do not know who is giving you the code, you do not know what it does, you do not know that it places the monies correctly into the appropriate account, without passing the details to any third parties.
Only get such code from reputable card transaction service companies - the scope for fraud otherwise is far too large. And remember, you personally could be liable for any monies lost if your action is seen to be negligent - which getting your code from a public forum would most certainly be!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Pick a provider you want to use and follow their integration documentation.
|
|
|
|
|
I used paypal in my site.Safe they give you the code and if you are certified most people will trust you and your site.Also it gave me some prestige and more visits when I put the paypal verified icon n my site.
|
|
|
|
|
I need help but i want custom menustrip for select example theme black or devexpress on my c# tool
|
|
|
|
|
And?
What have you tried?
Where are you stuck?
What help do you need?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Did you look it in the documentation? If they provide a license plan then surely they would provide an option to customize the controls.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I want to create a windows application in C#, in which I want to write some Text in textbox and click on a button. Then it would provide Audio of my text.
How can I do it?
|
|
|
|
|
|
|
You could have found the answer to this quite easily had you bothered to Google for it.
Google results for "C# text to speech example[^]"
|
|
|
|
|
|
Depends on the framework also, please read the above answers. Microsoft.Speech can be used, but if you are using .NET framework, then System.Speech [^] is what you are looking for. It includes APIs for text-to-speech (audio) code and you can use it to create your own application.
I have written an article for that also, An app that reads out text for you[^]. This article discusses a few things that help you in creating a sample application that works as a Text-to-speech converter.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
|
Hi
I want when user enter data in textbox and press 'Enter' ,change focus to another textbox.
It works but sounds like "Beep"!!!!
private void txtBinNumberInput_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
{
this.SelectNextControl((Control)sender, true, true, true, true);
I need remove sound...
|
|
|
|
|
Don't.
ENTER in a form is used to mean "Finished" or "Submit" and users are very used to this behaviour. Subverting it to fit a single use case is likely to confuse and annoy users rather than help them. Use TAB instead, which already does just that.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
In DataBase's forms when you press Enter focous will change...
|
|
|
|
|
That is true, for mainframe and mini environments where you use terminal emulators to interact with those machines.
On PC's though, the expected behavior is a bit different, as has already been explained.
|
|
|
|
|
You Are Right
But still, I Need Remove That Beep Sound
|
|
|
|
|
I know what you want. We're telling you that you're going against Microsoft's design guidelines. The guidelines are there to keep a consistent user experience across all applications. These guidelines were baked into the design of Windows Forms.
The reason you get the beep is because the TextBox, setup as single line input (the default), doesn't accept Enter as a valid key. On top of that, the form doesn't have its AcceptButton property set. Since neither control will accept the Enter key, Windows Forms knows that the key input isn't valid so it beeps to let the user know that.
Having said all that, it is possible to get rid of the beep, but you have to write your own TextBox control to do it. Create a new class, inheriting from TextBox. in the KeyPress (NOT KeyUp or KeyDown) event, put your Enter key handling code that you already have. You'll probably have to modify it a bit to get it to work. At the very least, you have to add one line of code when you handle the Enter key, e.Handled = true;
Compile that class and it'll show up in the ToolBox. Use that control instead of the normal TextBox when you want this functionality.
|
|
|
|
|
Thank You I Understand
|
|
|
|
|
Hai Friends,
I want to change my PC 'IP address' with C# program.
I got one code from internet.I tried so many times and with different possibilities but i couldn't get solution to my problem/requirement of changing PC 'IP address' programatically.
Thanks in advance for your kind replies.
|
|
|
|
|
That's because you can't do it.
There are two IP addresses involved here:
1) The "local" IP address by which you communicate to your router (or other internet gateway device) - this is likely to start with 192.168.xxx.xxx and can be changed, if you communicate with your local DHCP controller and ask it to re-assign you a new address. This is dependant on the actual kit you use for DHCP services, so there isn't a "one-stop" way to do it.
It is very unlikely that you actually want to change this IP address!
2) The internet IP address by which you communicate with websites - this will not start with 192.xxx.xxx.xxx but could start with almost anythign else.
This is probably the one you want to change to "hide" who you are from other sites. It's also the one you can't change at all!
Partly because it is shared by all devices connected to your router, so changing it would disconnect them from whatever they are doing, and mostly because it is assigned by your Internet Service Provider and may be Static (never, ever changes) or Dynamic (changes when the ISP recycles the connection). Dynamic IPs can be changed by resetting the ADSL connection, but in the case of Fibre based connections the "down time" has to be significant - hours at the least, and I have heard of days being needed to get a really new IP.
You can "sort of" change your IP by going via a internet based proxy server, but do bear in mind that they do record what you do, and may limit your activities and / or send the monitor data to various legal authorities. In addition, a proxy based system may change it once, but you will probably get the same IP the next time you use the same service.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I am writing a code for loading a multiple flat file into SQL server. Each flat file has different number of columns. Below are few examples.
FlatFile1:
sampleID ; rep# ; protein ; fat ; Lactose ; TS ; SNF ; GLucose;
12334 ; 1 ; 0.23 ; 0.4 ; 0.23 ; 3.4; 4.5 ; 0.9;
FlatFile2:
sampleID ; rep# ; Water ; TNC ; protein ; TS ; SNF ; Fat;
12134 ; 1 ; 6.1 ; 2.1 ; 5.6 ; 1.3; 6.5 ; 0.4;
FlatFile3:
sampleID ; rep# ; Ph ; Fat ; protein ; TS ;
10986 ; 1 ; 6.1; 2.1 ; 5.6 ; 1.3;
10207 ; 2 ; 5.0; 1.3 ; 3.1 ; 1.45;
My Output:
sampleID rep# protein TS Fat
12334 1 0.23 3.4 0.4
12134 1 5.6 1.3 0.4
10986 1 5.6 1.3 2.1
10207 2 3.1 1.45 1.3
My C# knowldege is very basic. After doing some research I came up with some code which is like below.
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.IO;
namespace SSISDYnanic.csproj
{
[System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
#region VSTA generated code
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
#endregion
public void Main()
{
{
string delimiter = Dts.Variables["User::Delimiter"].Value.ToString();
string TableName = Dts.Variables["User::TableName"].Value.ToString();
SqlConnection myADONETConnection = new SqlConnection();
myADONETConnection = (SqlConnection)
(Dts.Connections["BIReports"].AcquireConnection(Dts.Transaction) as SqlConnection);
string SourceDirectory = Dts.Variables["User::SourceFolder"].Value.ToString();
string[] fileEntries = Directory.GetFiles(SourceDirectory);
foreach (string fileName in fileEntries)
{
string columname = "";
System.IO.StreamReader file2 = new System.IO.StreamReader(fileName);
int counter = 0;
string line;
System.IO.StreamReader SourceFile =
new System.IO.StreamReader(fileName);
while ((line = SourceFile.ReadLine()) != null)
{
if (counter == 0)
{
columname = line.ToString();
columname = columname.substring(length(columname)-1,1).replace(";","")
columname = "" +columname.Replace(delimiter, ",");
MessageBox.Show(columname);
}
else
{
string query = "Insert into " + TableName +
"(" + columname + ") VALUES('" + line.Replace(delimiter, "','") + "')";
SqlCommand myCommand1 = new SqlCommand(query, myADONETConnection);
myCommand1.ExecuteNonQuery();
}
counter++;
}
SourceFile.Close();
}
Dts.TaskResult = (int)ScriptResults.Success;
}
}
}
}
1.) Problem with the code below is it writes all the columns into the table. And the table has to have all possible columns which I can't guess because I don't know. But no matter how many columns in the flat file I know the columns I want.
If code could be modified to pick only the 5 columns in my out put that would be great other wise if I could get help fixing below that is fine too.
2.) Also other problem is in the way the flat file is it ends with a delimiter (;) which results in a insert statement that ends with a ','for example
"Insert into tablename(sampleID ,rep#,Ph,Fat,protein,TS,) values (10986, 1,6.1,2.1,5.6,1.3,)"
columname = columname.substring(length(columname)-1,1).replace(";","")
So I added this in the code which doesn't work basically trying to replace last ":" with an empty space.
SVK
|
|
|
|
|
Something like this would work to parse the files:
public sealed class FlatFileLine
{
private sealed class MetaData
{
public readonly int? SampleID;
public readonly int? RepNo;
public readonly int? Protein;
public readonly int? TS;
public readonly int? Fat;
public MetaData(string[] fields)
{
for (int index = 0; index < fields.Length; index++)
{
string field = fields[index].Trim();
if (string.Equals(field, "sampleID", StringComparison.OrdinalIgnoreCase))
{
SampleID = index;
}
else if (string.Equals(field, "rep#", StringComparison.OrdinalIgnoreCase))
{
RepNo = index;
}
else if (string.Equals(field, "protein", StringComparison.OrdinalIgnoreCase))
{
Protein = index;
}
else if (string.Equals(field, "TS", StringComparison.OrdinalIgnoreCase))
{
TS = index;
}
else if (string.Equals(field, "Fat", StringComparison.OrdinalIgnoreCase))
{
Fat = index;
}
}
}
}
public string SampleID { get; private set; }
public string RepNo { get; private set; }
public string Protein { get; private set; }
public string TS { get; private set; }
public string Fat { get; private set; }
public static IEnumerable<FlatFileLine> ParseFile(TextReader reader, string delimiter)
{
if (reader == null) throw new ArgumentNullException("reader");
return ParseLines(ReadLines(reader, delimiter));
}
private static IEnumerable<string[]> ReadLines(TextReader reader, string delimiter)
{
string line;
while ((line = reader.ReadLine()) != null)
{
yield return line.Split(new[] { delimiter }, StringSplitOptions.None);
}
}
private static IEnumerable<FlatFileLine> ParseLines(IEnumerable<string[]> lines)
{
MetaData columns = null;
foreach (string[] fields in lines)
{
if (columns == null)
{
columns = new MetaData(fields);
}
else
{
yield return new FlatFileLine(fields, columns);
}
}
}
private FlatFileLine(string[] fields, MetaData columns)
{
if (columns.SampleID < fields.Length)
{
SampleID = fields[columns.SampleID.Value];
}
if (columns.RepNo < fields.Length)
{
RepNo = fields[columns.RepNo.Value];
}
if (columns.Protein < fields.Length)
{
Protein = fields[columns.Protein.Value];
}
if (columns.TS < fields.Length)
{
TS = fields[columns.TS.Value];
}
if (columns.Fat < fields.Length)
{
Fat = fields[columns.Fat.Value];
}
}
}
With that in place, your Main method would look something like this:
public void Main()
{
string delimiter = Dts.Variables["User::Delimiter"].Value.ToString();
string TableName = Dts.Variables["User::TableName"].Value.ToString();
string SourceDirectory = Dts.Variables["User::SourceFolder"].Value.ToString();
string query = @"INSERT INTO [" + TableName + "] (sampleID, [rep#], protein, TS, Fat) VALUES (@sampleID, @RepNo, @protein, @TS, @Fat)";
using (SqlConnection connection = Dts.Connections["BIReports"].AcquireConnection(Dts.Transaction))
using (SqlCommand command = new SqlCommand(query, connection))
{
foreach (string fileName = Directory.EnumerateFiles(SourceDirectory))
{
using (StreamReader reader = File.OpenText(fileName))
{
foreach (FlatFileLine line in FlatFileLine.ParseFile(reader, delimiter))
{
command.Parameters.Clear();
command.Parameters.AddWithValue("@sampleID", line.SampleID ?? string.Empty);
command.Parameters.AddWithValue("@RepNo", line.RepNo ?? string.Empty);
command.Parameters.AddWithValue("@protein", line.Protein ?? string.Empty);
command.Parameters.AddWithValue("@TS", line.TS ?? string.Empty);
command.Parameters.AddWithValue("@Fat", line.Fat ?? string.Empty);
command.ExecuteNonQuery();
}
}
}
}
Dts.TaskResult = (int)ScriptResults.Success;
}
NB: "rep#" is a bad name for a column in a SQL database, because of the "#" character. If possible, you should consider changing the name to something that only uses alpha-numeric characters - for example, "RepNo".
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you. It worked like a charm.
|
|
|
|
|