|
hi everybody!
Now, I'm designing datetime textbox by C# & ASP.NET, but I face on the problem: users access in our website and login on the datetime textbox by any date type,ex: dd/mm/yyyy or mm/dd/yyyy, .... , in SQL Server, we want to format this by mm/dd/yyyy date type.
How can we do it? function convert(datetime)?
please tell me!
study, study and study more
|
|
|
|
|
how about this version
//get culture info for a specific region
CultureInfo MyCultureInfo = new CultureInfo("de-DE");
DateTimeFormatInfo dt = MyCultureInfo.DateTimeFormat;
// set a new format pattern for the date
dt.ShortDatePattern="yyyy-MM-dd";
//parse the string with the new pattern
DateTime d = DateTime.Parse(textBox1.Text,dt);
the output is done the same way - just take there a different pattern
|
|
|
|
|
When i open my app its the right size, but you can resize it to strange and abnormal sizes.
How do i disable resizing?
|
|
|
|
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
after that - the form is not sizeable
|
|
|
|
|
And if you want to make them also cannot maximize the app,you can make this property to false;
this.MaximizeBox = false;
|
|
|
|
|
i can select entire row on Click/Double by using following code:
System.Drawing.Point pt = new Point(e.X, e.Y);
DataGrid.HitTestInfo hti = this.dgGDS.HitTest(pt);
if (hti.Type == System.Windows.Forms.DataGrid.HitTestType.Cell)
{
this.dgGDS.Select(this.dgGDS.CurrentRowIndex);
}
how can i do same on Mouse hover?currently on mouse hover or Mouse Move,it just selects First Row
MyBlogs
http://weblogs.com.pk/kadnan
|
|
|
|
|
there is a little mistake in your select statement.
try this:
this.dgGDS.Select(hti.Row);
but then more and more rows will be selected because there is no unselect of the old row
|
|
|
|
|
Hi,
I found an article here on Cp on how to use the push method of Crystal reports.
The only difference is however, that I create my datasets manually, therefore I think you need to define the fields in your report manually too. (correct?)
How can you do that? All the members are always 'read only', so my compiler claims.
tnx!
No hurries, no worries.
|
|
|
|
|
Hi all, please can anybody tell me how can I use a DLL created via C++ in C#.NET? I tried using the Add reference but it didnt' work. It gave me a message that it's not a valid assembly or com component.
SoCRaT
|
|
|
|
|
.NET can automatically handle COM objects, it generates RCW (Runtime Callable Wrappers) around them by itself.. For non-COM dlls, you'd have to use Pinvoke[^]. It's fairly easy. For eg, to access method Foo in X.dll, the following code will do..
class SomeClass
{
[DllImport("X.dll")]
private static extern void Foo();
public void SomeMethod() { Foo(); }
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
you can use the methods of a dll in c# in the following way:
[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, string lParam);
|
|
|
|
|
How much data can a dataset contain, i mean the size of dataset.
Thanks
|
|
|
|
|
Do you mean how many tables, or how many rows ? What size do you have in mind ? Did you consider just creating one and seeing if it goes big enough for you ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I am finding it difficult to add a value to pretty much any registry key on a Windows XP machine. The folowing code allows me to add the new key and or open the key as read/write but will not all the value to be created and set. Even if I manually add the value the code will still not adjust what the value is set to. I have tested this on 8 different Win XP machines ranging from no service packs to the most receint. I have tried running the program including this test code under administrator and user account levels in XP with no luck. Can someone please tell me why this code does not do what it is supposed to. I thank you in advance for your assistance.
private static void NoCMD()
{
keyValueInt="2";
subKey = "Software\\Policies\\Microsoft\\Windows\\System";
try
{
key = Registry.CurrentUser;
key.CreateSubKey(subKey);
key.OpenSubKey(subKey,true);
key.SetValue("DisableCMD",keyValueInt);
key.Close();
Console.WriteLine("Edit Complete: Current_User\\" + subKey + "\n");
}
catch(Exception ex)
{
Console.WriteLine("Edit: Current_User\\" + subKey + "\n" +
"ERROR: " + ex.ToString());
}
}
|
|
|
|
|
I just do this:
Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software").OpenSubKey("Graus", true).SetValue("PathLastOpened", value.ToString());
I like to hide them behind properties
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thank you very much for the quick reply and your assistance. I will give that a try and see if it works for what I am trying to accomplish and report back... Thanks again...
|
|
|
|
|
Well my friend, it worked perfectly, why chaining the arguments together instead of seperately would make such a difference we shall never know but heck, it works and that is amazing in and of itself. Thank you for your assistance. I rated your reply as a 5.0 perfect.
|
|
|
|
|
Glad to help
I have no idea why your old code shouldn't work, I just grabbed some of mine that does.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian's code uses the value returned by the CreateSubKey, OpenSubKey etc.. functions to do the next operation. Your code calls all those methods on just the key object. Maybe that's what is wrong, maybe you should be writing code like
retKey = key.CreateSubKey(subKey);
retKey = retKey.OpenSubKey(subKey, true);
...
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I actually tried that exact method with no luck, don't know why. Thanks for the idea though...
|
|
|
|
|
Hello everyone,
I want to implement a Font Bar(not FontDialog) like this,
______
B I U S
-------
Is there any ready-made control class in .net FCL? If not, how to realize it?
welspring
hope for help
|
|
|
|
|
There is no such ready-made control class in .NET base classes. However, you can use a toolbar in your project alongwith an ImageList control(in which I suppose that you might be implementing the RichTextBox control for showing bold, italics characters, etc.). After adding the imageList and toolbar, add different images in the Images property of the ImageList in its properties window in the designer. As a part of these images, you can supply your own images for "Bold", "Italics", etc. Now, select the toolbar in designer and go to its property window. Select the "ImageList" property of the toolbar and assign the value of the instance of the ImageList control added to your project. Now go to 'Buttons' property of toolbar and click on the Collection "..." button to add your buttons. While adding buttons, select the appropriate ImageIndex (which will link a particular image from the aforesaid ImageList to a particular button). Now you can add an event-handler for the "ButtonClick" event of the toolbar wherein you can provide code for linking these buttons with the formatting of the RichTextBox, such as italics, etc.
|
|
|
|
|
Why is the windows datagrid SO uncooperative (not my real question, I just couldn't resist). I need to create a datagrid column containing a pair of radiobuttons per cell. I can find plenty of examples that create a column that shows ONE control that shows up only when the cell is selected, but I want mine to show all the time (two radiobuttons visible in EACH row in the column).
If anyone could give me a clue about this I would really appreciate it.
thanks!
Deanna
|
|
|
|
|
Hi Deanna,
For displaying 2 radio buttons you can create a custom user control that has 2 radio buttons and use it in the data grid.
DataGridTextBoxColumn column1 =(DataGridTextBoxColumn)dataGrid1.TableStyles[0].GridColumnStyles[0];
column1.TextBox.Controls.Add(new WindowsControlLibrary1.UserControl1());
Thanks and Regards
SGS
|
|
|
|
|
I could, but normally doesn't that code go in the 'Edit' method of the column and only display the control when someone clicks the cell? I want them to display all the time.
If there's somewhere else I can put the code for my desired effect, please let me know.
thanks,
Deanna
|
|
|
|