|
You should just be able to do this:
<br />
char myCharacter = 'a';<br />
int myASC = (int)myCharacter;<br />
Tatham Oddie (VB.NET/C#/ASP.NET/VB6/ASP/JavaScript)
tatham@e-oddie.com
+61 414 275 989
|
|
|
|
|
No you can not. Only for basic characters.
Bo Hunter
<marquee behavior="alternate">Bo Hunter
|
|
|
|
|
Bo Hunter wrote:
No you can not
So how do you do it? I'm sure they wouldn't have excluded the capability from the C# libraries... 
|
|
|
|
|
you can do it. run it for yourself.
|
|
|
|
|
DataSet has has Tables propety which means it can hold more than one table. How can I add second table to dataset.In dataadapetr I can use a select commmand which get one table,how can i add two table so?
Mazy
No sig. available now.
|
|
|
|
|
Mazy, try something like this:
DataSet ds = new DataSet("myDataSet");
DataTable t1 = new DataTable("Table1");
DataTable t2 = new DataTable("Table2");
ds.Tables.Add(t1);
ds.Tables.Add(t2);
HTH
-Nick Parker
|
|
|
|
|
Thanks Nick,I should get table from database,.Should I use second dataadpater to fill the same dataset with second table or there is better way for it?
Mazy
No sig. available now.
|
|
|
|
|
Actually we use each DataAdapter to populate or edit only one table(with 4 associated delete , update , insert and select commands).
So, for inserting more than one table into a dataset , usually we use more than one DataAdapter .
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
Hi,
You can write a sql statement like this returning two tables:
"SELECT * FROM People; SELECT * FROM Street;"
That will populate two different tables on your DataSet, the first one containing all the people, and the second one with streets.
Hope this helps.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Andres Manggini wrote:
"SELECT * FROM People; SELECT * FROM Street;"
Oh,thats nice,can I run large SQL script like this?
Mazy
No sig. available now.
|
|
|
|
|
Try it once with the IDE/Form Designer first:
drag a dataAdapter to the form and configure it. Such as "SELECT * FROM Projects".
drag another dataAdapter to the form and configure it. Such as "SELECT * FROM People".
Now right-click the first dataAdapter icon and choose Generate Dataset. In the form that pops-up choose New Dataset, and name the dataset something like DSAll. This is actually the schema name, but a dataset will be created, named like dsAll1.
Now right-click the "other" dataAdpater and choose Generate Dataset. This time, choose "Existing Dataset" and select the dataset you just created. Then you have two dataAdapters (one for each table) which both update data in a single dataset (which contains two tables).
You can then look over the Designer generated code to see what it did.
|
|
|
|
|
Thanks
Mazy
No sig. available now.
|
|
|
|
|
I want a very generic way to notify other objects that an object has changed in some way. I don't want to put any code whatever in set accessors. Does C#, .Net support this? I have some vague recollection of a similar fuctionality being supplied by MessageSinks and intercepting calls at the OS level.
|
|
|
|
|
delegates and events...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Maybe I was too vague. Clearly the overall architecture would have to use delegates and/or events. The problem is how to centralize the code which winds up calling them.
Assume that the ancesctor class Publisher maintans an internal list of Subscribers. Each time something changes the Publisher descendent calls NotifySubscribers(). Each subscriber is instructed to fire a delegate with a specified signature. This is the Observer pattern.
If I have an object with two properties
public class MyObject : Publisher
{
private object propA
public object PropA
{
get{return propA;}
set
{
NotifySubscribers{this); <-- I Don't want this here
propA = value;
)
}
private object propB
public object PropB
{
get{return propA;}
set
{
NotifySubscribers{this); <-- because it has to be repeated here and everywhere else
propA = value;
)
}
}
What I am asking is I think deeper into the .Net Framework than I have gone.
Robert Zurer
|
|
|
|
|
this is something that is not handled by .net for you - its a general oo problem.
the only way to reduce this is to use a utility object to set values, and that object raises the event.
ps you should not:
NotifySubscribers{this);<br />
propA = value;
it should be:
<br />
propA = value;<br />
NotifySubscribers{this);<br />
otherwise the clients can't see the new value....
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
The mistaken logic in the code was an oversight. Thanks.
The reason I this could be a possibility, is that I read somewhere that things like logging can be added to applications by the use of MessageSinks and Custom attributes. In this model, calls are intercepted at runtime by a series of object which implement IMessageSink.
Although I didn't mention it, the above calls to NotifySubscribers{this) would really be calls to a UnitOfWork object which would then update or validate the objects in its charge.
Robert Zurer
|
|
|
|
|
In my Window Form Application, I create many modaless forms(by different class).
How can I get the current focused form object in any forms?
Thanks a lot.
Evan Chen
|
|
|
|
|
when i type in System.Environment.GetFolderPath it's asking for a value of type System.Environment.SpecialFolder but when i try to type that in it doesn't show up in the list that comes up. what am i doing wrong?
thanks,
Rob
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
show up in the list that comes up
I guess you are referring to intellisense.
This works fine for me:
<br />
this.textBox1.Text =<br />
System.Environment.GetFolderPath(System.Environment.SpecialFolder.Recent);<br />
R.Bischoff
.NET, Kommst du mit?
|
|
|
|
|
why is the System namespace in both System.dll and mscorlib.dll? and when i use object browser to look in the mscorlib.dll it has System.Environment but no SpecialFolder enum listed. so why does the code that you gave me work if it won't show up in object browser or intellisense? are there other classes, namespaces, etc. that are not listed?
thanks,
Rob
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
This will enumerate all special folders with their respective path.
requiremnts, create a ListView named listView1 in your win form, then paste code into button event handler or Initialize()
<br />
private void button2_Click(object sender, System.EventArgs e)<br />
{<br />
ListViewItem lvi = null;<br />
foreach(Environment.SpecialFolder sf in Enum.GetValues(typeof(Environment.SpecialFolder)))<br />
{<br />
lvi = new ListViewItem(Enum.Parse(typeof(Environment.SpecialFolder), sf.ToString(), true).ToString());<br />
lvi.SubItems.Add(Environment.GetFolderPath(sf));<br />
listView1.Items.Add(lvi); <br />
}<br />
}<br />
R.Bischoff
.NET, Kommst du mit?
|
|
|
|
|
I guess the subject says it all. I have a C# project that calls native methods. I have set the "Allow unsafe code blocks" option to TRUE in the project build configuration dialog. However every time I restart studio, builds of this project will turn up the message that this option is set to false. In order to fix the problem, I must set the option to false and apply changes, then set it back to true and apply changes again.
Is there a fix for this bug? I hate having to repeat myself again and again every time I open the project.
|
|
|
|
|
Did Vs.NET make a clean exit, after you applied the changes? IOW, change setting, do a complete rebuild, and exit VS.NET, restart. Should work...
Did you have two copies of VS.NET open?
leppie::AllocCPArticle("Zee blog");
|
|
|
|
|
Yes. Changes were applied, solution was saved, rebuild was done. VS did a graceful exit and when I return I get the same message. In fact, examination of the configuration properties page reveals that the setting is correct - but for some reason the compiler is not acting in accordance with the setting until you follow the "set it false/apply/set it true/apply" methodology described above.
|
|
|
|