|
Im trying to send a string with the value:"\xHexaValue" to a vb application.
The HexaValue is of an Ascii code from the charachter table 128-255.
In the VB application Im searching for that value (chr(&HHexaValue)) but the value which was sent was converted to the NOT value of the actual value in Hexa. I tryed use the Encoding methods but without success.
|
|
|
|
|
From where or what are you sending the string? Does it really use ascii code?
Either the value is not converted at all, and still remains as \xnn in the text, or whatever you use to enter the string converted it to a character in a different character set, perhaps ansi or unicode.
---
b { font-weight: normal; }
|
|
|
|
|
|
Hi.Im actually working on a datagrid which shows data from an Access database.I was working till know only with one table so my dataset is configured for one table only.How can I add other tables from the Access database I was using without beggining other C# solution?
|
|
|
|
|
How are you configuring the dataset ? Ideally, you'd have a data access layer which returns datasets based on any SQL query you like.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
And your data access layer can be configured to return another table that can be added to your existing dataset at runtime. Thanks.
modified 17-Jul-19 21:02pm.
|
|
|
|
|
Yes it is working on a SQL query cause actually im going through the Microsoft sample of datagrid using.Now I want to do some stuff by myself thats why need to add some tables.Thank you
|
|
|
|
|
depends on what you want.
Your DataSet can hold multiple tables.
(eg. query = "Select * from TableOne;Select * from TableTwo"; )
When you execute it and Fill the DataSet you'll have two tables in your dataset.
(then you can even set constraints and relations...)
thus:
yourdataset.Tables[0].Whatever;<br />
yourdataset.Tables[1].Whatever;
you can also create a DAL (data access layer which you can reuse.
eg. create a method which takes a query and returns a dataset.
Then you can do something like this:
DataSet myset1 = DalComponent.DoSelect("Select * from TableOne");<br />
DataSet myset2 = DalComponent.DoSelect("Select * from TableTwo");
(don't forget to create a new DataSet in your DoSelect method.
good luck.
No hurries, no worries.
|
|
|
|
|
Hello,
I added a MouseHover event on my usercontrol... just noticed that it uses the argument EventArgs instead of MouseEventArgs, is there a way to get the coordinates of the mouse pointer that is hovering over the control? Or maybe there's a workaround?
Thanks!
Rafferty
|
|
|
|
|
Hi!
You can always use Cursor.Position to retrieve (or set) the position of the mouse pointer.
Regards,
mav
|
|
|
|
|
Ahh! hehe didn't know there is such a class. Thanks Mav!
Rafferty
|
|
|
|
|
Hi,
My requirement is to export Russian Data stored in Oracle 9i Database to a CSV file.
When the below code is used to export data the Russian Characters are shown as Junk characters when the CSV file is opened in MSExcel. If the same file is opened in Notepad, the Russian Characters are displayed correctly.
Can someone advice, how to export Russian Characters that can also be displayed correctly when viewed in Excel Sheet.
It will be highly appreciated.
With Regards,
/////////////////////////////////////////////////////////////////////////////
/////////////////////// PROGRAM CODE ////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
String strFileName = "";
FileStream fs = null;
BufferedStream buff = null;
StreamWriter writer = null;
bool bExported = false;
try
{
SaveFileDialog saveFileDlg = new SaveFileDialog();
saveFileDlg.Filter = "CSV Format|*.csv";
saveFileDlg.Title = "Save File";
saveFileDlg.RestoreDirectory = true ;
saveFileDlg.ShowDialog();
if(saveFileDlg.FileName != "")
{
strFileName = saveFileDlg.FileName;
saveFileDlg.Dispose();
fs = new FileStream
(strFileName,FileMode.OpenOrCreate,FileAccess.ReadWrite);
buff = new BufferedStream(fs);
writer = new StreamWriter(buff);
writer.Write(strWriteData);
writer.Flush();
bExported = true;
writer.Close();
buff.Close();
fs.Close();
}
return bExported;
}
catch(Exception exp)
{
throw exp;
}
finally
{
writer = null;
buff = null;
fs = null;
}
|
|
|
|
|
CSV files is really a mess, as there is no standard at all to rely on...
You have to find an encoding that the destination program can handle, and use the System.Text.Encoding classes to convert it.
Example:
UTF8Encoding utf8 = new UTF8Encoding();<br />
Byte[] encodedBytes = utf8.GetBytes(unicodeString);
---
b { font-weight: normal; }
|
|
|
|
|
When some action has been added to a context menu in Windows Explorer using a Verb such as "save" (which is not the default action), how to access that Verb from the Main function of the program which is invoked from such Context Menu item in explorer, i.e., how to choose as to which action is to be taken depending upon the command-line arguments?
Is there any sample code for this purpose?
Thanks.
|
|
|
|
|
Just check the arguments that are passed in, and branch accordingly. static void main has a string array passed into it, that's the arguments collection.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks.
But, arguments show only the filename on which the context menu was clicked. What about the "Verb" or the action such as "save"? I mean how to check whether context menu item corresponding to Verb "open" was clicked or Verb "save"? This is relevant when more than one context menu items are placed by one application.
Thanks in anticipation.
|
|
|
|
|
OK, I get it. Try this[^] MSDN page.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi all,
The dateTime is showing in a Label like this:
this.label1.Text=DateTime.Now.ToString("dd ,MMMM ,yyyy");
Now suppose that this program open in 24 hours ..Then How can I change date Time of the Label Continuously with out using a Timer?
Can any one send me better url to download DateTime Components with attractive skins?
thanks in advance..
|
|
|
|
|
pubududilena wrote:
Then How can I change date Time of the Label Continuously with out using a Timer?
You can't. to change something, you need an event, and if the event is time, you need a timer.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
as Christian said you need a timer
but why you want to do t without timer?
|
|
|
|
|
hi,
If I use Timer ,Then Application is going to be Little Slow.But If I used another Component like Date Time Picker then it is ok..But I coundn't find atrractive DateTime Component or Library.
regards,
pubudu
|
|
|
|
|
A timer and a date/time picker has completely different uses. What is it that you are try to do, really?
---
b { font-weight: normal; }
|
|
|
|
|
Well any component you use will have a 1 sec timer.. you need to refresh your control on 1 second, don't you?
|
|
|
|
|
You could just change the text of the label continously in a loop. However:
This would cause the text of the label to flicker a lot.
It also uses all the cpu time it can, causing the computer to run at 100% cpu all the time. This will give you a lot of heat, and render the computer virtually useless for anything else.
---
b { font-weight: normal; }
|
|
|
|
|
private System.Threading.Thread timerAvoidanceThread = null;<br />
private void Form1_Load(object sender, System.EventArgs e)<br />
{<br />
timerAvoidanceThread = new System.Threading.Thread(new System.Threading.ThreadStart(TimerReplacement));<br />
timerAvoidanceThread.Start();<br />
}<br />
<br />
private System.Threading.AutoResetEvent wellItsNotATimer = new System.Threading.AutoResetEvent(false);<br />
public void TimerReplacement()<br />
{ <br />
while(true)<br />
{<br />
if(wellItsNotATimer.WaitOne(1000, false))<br />
{<br />
break;<br />
}<br />
<br />
wtfLabel.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}<br />
}
|
|
|
|