|
Thanks - IDE looks pretty cool. Its a bit like DrPython
Davy
My Personal Blog - Homepage
|
|
|
|
|
this is what i need to do:
user enters a date in the DateTimePicker.
the code needs to validate the date agains a few criterias.
if it does not pass the validation. display a message asking if the user really wants that date.
if the user wants to continue with the date, just go ahead.
if not the date should go back to what it was.
I am having the hardest time to get the program to flow thist way.
I tried to extend the datetimepicker to add a onchanging event, i tried the validating event. But so far there is always one thing in this flow that does not work.
Can any one help!
thank you
tephra
|
|
|
|
|
Use the TextChanged event
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
simply use the validating event
with this event you can cancel the leave event via eventarg
|
|
|
|
|
The problem with the validating event is the messagebox. the messagebox kicks the "valuechanged" event. even if i disable the event before the messagebox, the value already changed and the event is not kicked afterwards when i want to. also there is the path that does not go through the messagebox(when the date is valid). and so on...
I keep getting caught on something.
it would be simpler if i could get the messagebox to stop changing the value of the datetimepicker before the validating is finished.
thank you
|
|
|
|
|
...another problem is that the validationEvent is not trigged when I choose a date in the calendar.
|
|
|
|
|
Hello there!
I am currently writing a chat-program. All of the network functions are (almost) working properly. But i have one problem though. I want the richTextBox to autoscroll when the text goes behind the border of the control (like Windows Messenger)
I hope that you can help me with this!
Regards
|
|
|
|
|
richTextBox1.Focus();
richTextBox1.SelectionStart=richTextBox1.TextLength;
richTextBox1.ScrollToCaret();
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
Thanks a lot!!
I tried something similar, but it didn't work..
Thanks Again!
Regards
|
|
|
|
|
I'm using odbc to call stored procedures in a way similar to the small amount of sample code below:
OdbcCommand command = conn.CreateCommand();
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "call proc(?, ?, ?, ?, ?, ?, ?, ?, ?)";
OdbcParameter param = new OdbcParameter("paraName", OdbcType.VarChar, 4);
param.Direction = ParameterDirection.Input;
command.Parameters.Add(param);
command.ExecuteNonQuery();
...and then accessing them like this:
command.Parameters["paraName"].Value;
This has been working great; except now I have encountered a situation where the stored procedure is attempting to return an entire table (instead of a single record) as one of its output parameters. How do I handle this? Is there a special Odbctype that I should be using? And then, how I access each record within the table once it has been retrieved?
Thanks!
|
|
|
|
|
Hello,
Here's what I'd like to do:
I have a byte[]. This could contain anything. I want to search it and replace every instance of "OldText" with "NewText". I'm actually trying to expand a token. So if I find the token, I want to replace it with the expanded value. Here's what I'm trying to do (pseudo-code)
------------------------------------------------------------------------
string Token = "%SomeToken%";
string Value = "ExpandedToken";
byte[] Data = GetRegBinary(); // Data contains some REG_BINARY data
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
// Convert the OldText to Base64String
byte[] buf1 = enc.GetBytes(Token);
string OldText = Convert.ToBase64String(buf1);
// Convert the NewText to Base64String
byte[] buf2 = enc.GetBytes(Value);
string NewText = Convert.ToBase64String(buf2);
// Convert the target data to Base64String
string TargetData = Convert.ToBase64String(Data);
// Now replace the OldData with the NewData in the TargetData
TargetData = TargetData.Replace(OldData, NewData);
// Convert the TargetData back to Byte[]
Data = Convert.FromBase64String(TargetData);
------------------------------------------------------------------------
I was hoping I could use some built-in encoding so I wouldn't have to write my own. This seems like a good logical approach but it's not working (I don't know why) and I'm getting the feeling that I'm using the wrong tool for the job...
Any ideas?
Thanks!
-Ian
|
|
|
|
|
What about something like the following:
ASCIIEncoding ae = new ASCIIEncoding();
byte[] bInput = ae.GetBytes("Hello Nick");
string sConversion = ae.GetString(bInput);
string sOutput = sConversion.Replace("Nick", "World");
byte[] bOutput = ae.GetBytes(sOutput);
|
|
|
|
|
Beautiful! Thank you!
-Ian
|
|
|
|
|
Is there a way to login to the Yahoo network using a Credentials object and then retrieve pages based on those credentials?
For example, I want to write something that will automatically check for and inform me if I have any email messages.
Thanks for any help.
|
|
|
|
|
I have a datagrid with one long colunm binding from a dataset. Is there a way to break it to multiple colunm to make it look better. Thanks
|
|
|
|
|
try to make this column not DataColumn but DataGridTextBoxColumn in the DataGridTableStyle and then after setting :
<br />
DataGridTextBoxColumn col = new DataGridTextBoxColumn();<br />
col.MappingName = "youColumnName";<br />
col.TextBox.MultiLine = true;<br />
col.Width = theWidthYouWant;<br />
DataGridTableStyle styl = new DataGridTableStyle();<br />
styl.MappingName = yourDataSet.yourTableName;<br />
style.GridColumnStyles.Add(col);<br />
dataGrid1.TableStyles.Add(styl);<br />
and there is a very good thing that you won't apply it to each row ,by default it's applied to all the columns in all the rows in this datagrid
|
|
|
|
|
Hello!
I'm starting to develop in C# for pocket pc's...
Can anyone tell me a good place to get some examples on the small device C# api?
Thanks a lot!
b4silence - Portugal
|
|
|
|
|
All,
I am writing a program that looks at a registry entry and based on the type of data at a particular key, performs different operations. So, given a RegistryKey item opened to a specific key, how do I determine the type of data stored there? Is there a way I can compare the key type against a REG_SZ or REG_DWORD? I looked at the GetType function but that seems to return a generic Microsoft.Win32.RegistryKey type based on the open key.
Any help would be greatly appreciated.
Regards,
Brigg Thorp
Senior Software Engineer
Timex Corporation
|
|
|
|
|
If you get a registry value that is REG_SZ, the GetType() method will return System.String. For REG_DWORD values it returns System.Int32. For REG_BINARY values it returns System.Byte[]. You can compare against these values. You might be able to use the "is" keyword as follows:
if(myRegValue is System.String)...
If that doesn't work (it's been a while since I've needed to do this) you can always fall back on a string compare:
if(myRegValue.GetType().ToString() == "System.String")...
I think the first way should work though...
Hope that helps.
Regards,
Ian
|
|
|
|
|
Worked perfectly! Thanks
Brigg Thorp
Senior Software Engineer
Timex Corporation
|
|
|
|
|
The Registry class doesn't expose any kind of method to determine the exact registry type that is stored. The class was written to insulate you from having to worry about those kind of details. IMHO, it also made the
Registry utterly useless.<br />
<br />
In order to get this functionality, you'll have to write your own code to P/Invoke the Win32 API Registry functions to enumerate the Values in a specified Key (RegOpenKeyEx, RegEnumValue), then call the RegQueryValueEx functionto return the Type and Data associated with the Value names returned by RegEnumValue.<br />
<br />
No, I don't have any example code for it. Try Google for a more comprehensive Registry class.<br />
<br />
<br />
<br />
RageInTheMachine9532<font size="-1"><br />
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome</font>
|
|
|
|
|
Check out Ian's approach above. It actually works very well for my needs.
Regards,
Brigg Thorp
Senior Software Engineer
Timex Corporation
|
|
|
|
|
Like system files and stuff, when you try to delete them, it says that it cant.
I want to know if i can protect a file in some way from deletion, i only want something simple, so if its to complicated dont bother, (or direct me to an article or something, maybe i'll look at it).
And no im not making a virus (that would be mean), its for a file encryption thing, and i dont want people to be deleting files that they cant access
|
|
|
|
|
The Undefeated wrote:
and i dont want people to be deleting files that they cant access
If they can't access the file, they can't delete it.
The only sure fire way to stop this from happening is to set the appropriate NTFS Permissions on the file. You CANNOT stop anyone from deleteing a file through the use of code. Unless, of course, you write a file system extension, which is not for the faint of heart or weak of COM Interop skills!
What are you really doing? What's the real goal and what is your project about?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The reason that some of the system files prevent you from deleting them is because they are in use. But I hardly think creating a dummy application that holds a file open to prevent it from being deleted is appropriate. If you don't want it deleted then change file permissions, or keep a 'cache' directory that will replace the file if it notices it is missing. This is something Windows XP does.
-
Drew
|
|
|
|