|
It works; if you have a better alternative, please explain
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Create your own "date class"; it becomes self-aware and you don't have to worry about "attributes".
Which begged the question: where / how are the "dynamic" date range values originating in the first place?
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
when i insert hebrew on mySql it goes well but when trying to pest hebrew data from winForm is I get "???"
|
|
|
|
|
That's probably more to do with how you are retrieving and displaying it than anything else: "Hebrew" is a part of a characters set, and not all sets will contain the appropriate glyphs for it to display correctly. When it doesn't, one of the displays you get is '?' to indicate it.
The big possibility is that you are storing them in a non-UNICODE column in your DB: If it's NVARCHAR it's OK, if it's VARCHAR then it won't work correctly.
So start by doing "test inserts": use your existing code to insert a "known good" Hebrew phrase string to SQL, and simultaneously convert it to a byte array:
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(myHebrewString);
Then retrieve the same string from the DB (using your existing code) and convert that to a byte array as well.
Compare the strings, and compare the byte arrays. If they are the same then the DB and the store / restore code is fine, so you need to start looking at your display code.
Sorry, but we can't do any of that for you!
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!
|
|
|
|
|
I work with mysql VARCHAR utf8_bin and There is no option of NVARCHAR
|
|
|
|
|
Hi,
indeed VARCHAR is OK for MySQL; NVARCHAR is an SQL type (e.g. SQLServer) and doesn't exist in MySQL.
Did you add Charset=utf8; to your connection string? (ref[^])
|
|
|
|
|
it's work well Thank you for your time and your support
|
|
|
|
|
A method returning a string value of html content when using webbrowser control in C# windows Application .I need to extract a specific data from the html table TD which has an id to specify . If some help me to extract the data easily with any methods . Thanks
<table class="userList w990 marginTop10">
<tbody>
<tr>
<th class="w195 whiteFont leftAlign">Status</th>
<td class="even width150" id="status">Active</td>
<th class="w195 whiteFont leftAlign">Name</th>
<td class="even" id="name"> NATESAN</td>
</tr>
</tbody>
</table>
MARTIN
|
|
|
|
|
|
I'm impressed you resisted the urge to link to that StackOverflow answer about parsing HTML with Regex.
Or to quote the shorter version:
- You have a problem.
- You decide to solve it with regular expressions.
- You now have two problems.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Only 2?
You must be a Regex Guru!
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!
|
|
|
|
|
RegEx is inappropriate. You can use LinqToXML if your needs are simple and you don't want to use HTMLAgilityPack.
".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
|
|
|
|
|
Im trying to figure out Delegates as I have read this is the best way to pass Values from one form to another.
I have tried to do this but am getting an error.
So to test I am trying to do the following.
Form1 has a button which opens Form2 which contains a DatePicker. The user selects a date and clicks OK. I then want the date passed back to a textbox on Form1.
This is my code.
FORM1 - CODE (The getEffDate in this code is where im getting the error.)
private void TestingButton_Click(object sender, EventArgs e)
{
Form_EffectiveDate effDate = new Form_EffectiveDate();
if (effDate.ShowDialog() == DialogResult.OK)
{
EffDateTextBox.Text = Form_EffectiveDate.getEffDate;
}
}
FORM 2 - Code
namespace Manager_Changes
{
public partial class Form_EffectiveDate : Form
{
public delegate void GetEffDate(object sender);
public GetEffDate getEffDate;
public Form_EffectiveDate()
{
InitializeComponent();
}
private void DateOKButton_Click(object sender, EventArgs e)
{
getEffDate(effDateTimePicker.Value.ToString());
DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
}
}
Chris Wright
|
|
|
|
|
|
Perfect! I will get researching again. I appreciate the information, thanks @DalekDave.
As I am new to C# its hard to tell if someone is right when they say "the best way" as that might just be personal preference.
Thanks again, have a great day.
Chris Wright
|
|
|
|
|
I'm not DalekDave - I'm OriginalGriff.
DalekDave is someone I'm winding up a little by automatically sending him an email every time I post something!
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!
|
|
|
|
|
Apologies, this is my first time using Code Project. Its not structured like a normal forum haha
Chris Wright
|
|
|
|
|
No problem!
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!
|
|
|
|
|
|
No, the Child raises the event to say "data available", the Parent handles the event and fetches it using the Child instance and property.
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!
|
|
|
|
|
I usually do it this way:
private void TestingButton_Click(object sender, EventArgs e)
{
using (Form_EffectiveDate form = new Form_EffectiveDate())
{
if (form.ShowDialog(this) == DialogResult.OK)
{
EffDateTextBox.Text = form.EffectiveDate;
}
}
}
In Form_EffectiveDate , set the OKButton property of the form to DateOKButton (this negates the need to write an event-handler for the button). Then:
public partial class Form_EffectiveDate : Form
{
public DateTime EffectiveDate
{
get { return effDateTimePicker.Value; }
}
public Form_EffectiveDate()
{
InitializeComponent();
}
}
enum HumanBool { Yes, No, Maybe, Perhaps, Probably, ProbablyNot, MostLikely, MostUnlikely, HellYes, HellNo, Wtf }
|
|
|
|
|
Thank you, I could give this a go too, it all helps with my learning.
Can I ask what you mean by "In Form_EffectiveDate, set the OKButton property of the form to DateOKButton (this negates the need to write an event-handler for the button )"?
I clicked the form and looked through the properties but couldn't see anything relating to OKButton.
Chris Wright
|
|
|
|
|
In the designer view of the form (not the code-file), click on the top of the form. In the properties windows, the form itself will now be selected. Amongst all properties of the form, you have one which is called AcceptButton (my mistake, I gave you a wrong name); set this one to the name of the OK button (you can select it). When that is done, you no longer need to write an event-handler (a method) for the button's click event; the framework will wire up everything and on click of the button the form will be hidden and return DialogResult.OK .
enum HumanBool { Yes, No, Maybe, Perhaps, Probably, ProbablyNot, MostLikely, MostUnlikely, HellYes, HellNo, Wtf }
|
|
|
|
|
Wow, this is nice to know. Thank you so much, I am loving learning C#
Chris Wright
|
|
|
|
|
Phil.o did make a small mistake: highlight your button, and set the "DialogResult" property to "OK" for it to close the form and return DialogResult.OK.
The Form.AcceptButton property just tells the form that an ENTER keypress is the equivelant of clicking the button. (Form.CancelButton does the same thing, but with the ESC key.)
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!
|
|
|
|