|
If you have Spaces in your field names or Reserved words then you have to put field name in [] to get it to work.I think it should work like this:
DataView dv = ds.Tables[0].DefaultView;
dv.Sort = "[AVG_VALUE]DESC";
|
|
|
|
|
Hello,
I want to do some windows API operation from C#.
and for that i want to import user32.dll please
give me specific syntax for importing dll from the
.cs page at runtime
Rahul Patel,
Software Engineer,
Gateway Technolabs
-- modified at 6:26 Tuesday 13th February, 2007
|
|
|
|
|
[DllImport("user32")]
private static extern UInt32 GetKeyboardLayoutList(int nBuff,ref int lpList);
|
|
|
|
|
thank a lot for giving me a solution....
|
|
|
|
|
You need to use something like this:
[DllImport("user32.dll")]
< Declaration of function in user32.dll to be used here preceded by static extern >
You have to declare each function you want to use in C# code in the above manner.Moreover you should write this code where you are declaring other variables of your class which is normally at the start of the class.
After that you can use those functions in your C# code. Keep in mind that all the types used while declaring function prototypes must be C# types and must not contains Win32 or other languages types.
Regards,
Wasif Ehsan.
|
|
|
|
|
I am exporting data from A Repeater to Excel sheet and my code works fine.
But I have used 2 repeaters side by side in the table.
When I export to excel I need to get the Excel data in the same mannar as side by side.
But I am getting the other repeater data in anothe line which doesn't look good.
Any body helps me in this
Thanks
Hima
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
Hello,
I m using Visual Studio 2005.Doing windows project in C#.Net.In that
i m using popup window forms.All details in text boxes are getting filled.But combo box and list boxes are not showing correct records?
bubuli
|
|
|
|
|
What records do ou expect them to have ? What code is setting these values for you ? you've given us nothgn to go on
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I m taking records from database (sql server 2000) depending on the id of selected record from the datagrid.I m using Binding navigator.On that i have taken command button.On click event of that button i m displaying another form,in that form i m getting above explained problem.
bubuli
|
|
|
|
|
Have you tried debugging the application to ensure the value you're sending to the database is the correct one?
Kay Lee
-Just your average coder
|
|
|
|
|
Hi,
I am trying to write an windows application which needs to capture the text selected from other applications as well.
I would like to know how we can capture a text that gets selected when we double click on the mouse. When any text is selected in any of the applications (not only the application that i use to capture the Text value), i need to capture the text. For example when we select a text in the notepad, and double click the mouse on the application that i have created, then the text selected in the Notepad should be captured and displayed in my application. Is there a way to do this ...
Thanks in advance
CSharpbeginer
|
|
|
|
|
There's a windows API called WindowFromPoint. If you p/invoke that, you can call GetWindowText ( another p/invoke ) to get the text of the window your mouse is under. How far that will get you, I don't know.
It's odd to me, I know of no commercial software that does this, but it gets asked for so often.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi Everyone,
I have some problem with override of background in an TextBox.
The text don't merge with background, lock at code below.
Many thanks in advance.
/Gywox
<br />
using System;<br />
using System.Drawing;<br />
using System.Drawing.Drawing2D;<br />
using System.Globalization;<br />
<br />
namespace System.Windows.Forms<br />
{<br />
public class TextBoxDate : TextBox<br />
{<br />
private DateTime date;<br />
private CultureInfo culture = CultureInfo.CurrentCulture;<br />
private bool validDate = false;<br />
private Brush backgroundBrush = new SolidBrush(SystemColors.Control);<br />
<br />
public TextBoxDate()<br />
{<br />
this.SetStyle(ControlStyles.UserPaint, true);<br />
this.backgroundBrush = new HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(255, 128, 128), this.BackColor);<br />
}<br />
<br />
public CultureInfo Culture<br />
{<br />
get<br />
{<br />
return this.culture;<br />
}<br />
set<br />
{<br />
this.culture = value;<br />
}<br />
}<br />
<br />
public DateTime DateTime<br />
{<br />
get<br />
{<br />
return new DateTime(this.date.Year, this.date.Month, this.date.Day, this.culture.Calendar);<br />
}<br />
}<br />
<br />
protected override void OnTextChanged(EventArgs e)<br />
{<br />
base.OnTextChanged(e);<br />
Parse();<br />
}<br />
<br />
protected override void OnLeave(EventArgs e)<br />
{<br />
base.OnLeave(e);<br />
if (this.Text != string.Empty && this.validDate)<br />
{<br />
this.Text = this.DateTime.ToString(this.culture.DateTimeFormat.ShortDatePattern, this.culture);<br />
}<br />
}<br />
<br />
protected override void OnPaintBackground(PaintEventArgs pevent)<br />
{<br />
base.OnPaintBackground(pevent);<br />
if (this.Text != string.Empty)<br />
{<br />
if (!this.validDate)<br />
{<br />
pevent.Graphics.FillRectangle(this.backgroundBrush, this.ClientRectangle);<br />
}<br />
}<br />
}<br />
<br />
private void Parse()<br />
{<br />
DateTime resultDate;<br />
<br />
this.validDate = false;<br />
if (DateTime.TryParse(this.Text, this.culture, DateTimeStyles.AllowWhiteSpaces, out resultDate))<br />
{<br />
this.date = resultDate;<br />
this.validDate = true;<br />
}<br />
this.Invalidate();<br />
}<br />
}<br />
}
|
|
|
|
|
A textbox is a very nasty control. It draws itself outside it's paint message, so it's very hard to change how it looks.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i want to list all Computer Name, and Ip Address for the Domin "WLINKTECH". i use the following code but get an error like this, so plz help me about the problem.
--------------------
using System;
using System.DirectoryServices;
namespace IPAddressof_RemoteComputer
{
public class Class1
{
public Class1()
{
//
// TODO: Add constructor logic here
//
}
public void getIpCName()
{
DirectoryEntry entry = new DirectoryEntry("LDAP://wlinktech");
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.Filter = ("(objectClass=computer)");
Console.WriteLine("Listing of computers in the Active Directory");
Console.WriteLine("============================================");
foreach(SearchResult resEnt in mySearcher.FindAll())
{
Console.WriteLine(resEnt.GetDirectoryEntry().Name.ToString()); }
Console.WriteLine("=========== End of Listing =============");
}
}
}
---------------
Error like this
------------------
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in system.directoryservices.dll
Additional information: The server is not operational
Sanjit.rajbanshi@wlinktech.com
|
|
|
|
|
Hi Sanjit.rajbanshi,
I have tested your code in Window Application (C#) after changing my AD name (sync.net). It's working fine. I have no problem with it. maybe. you are getting this error cuz you dont have the permission or you might put wrong AD name.
If your application is web application then you need to impersonate ur account.
|
|
|
|
|
I am using Client-server Architeture for my c#.net Window base Application.
For that I am using TCP Remoting.
How can I preserve Connection object?
means Only once Connection will establish while log in.and it will available
me through life time of application.
Hallo
|
|
|
|
|
Singleton Pattern?
Been a while since I learned about it, but as I remember, it does the trick
|
|
|
|
|
Hello,
May be you can try to store that object using binary serialization and use it any time you want.
This is just one idea I want to share with you.
nishu
|
|
|
|
|
It's dangerous to assume that the connection will always be there throughout the life of your application. What happens if the machine at the other end is restarted? Your connection is no longer valid, and operations on it will fail.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi all
I am working in c#.net
in my project i need create report using dynamic sql (i.e. parameter is passed at run time )
e.g
select * from employee where m_month = "runtimepara1" and m_year= "runtimepara2"
can anyone help me
thanks for your time
|
|
|
|
|
Build your query like this:
string sql = "SELECT * FROM Employee WHERE m_month = @month AND m_year = @year";
SqlCommand cmd = new SqlCommand(sql, connection);
cmd.Parameters.Add("@month", theMonth);
cmd.Parameters.Add("@year", theYear);
Also, SELECT * is inefficient. You should specify the columns that you want to return.
|
|
|
|
|
But I think it's used in Crystal ReportGeneration
i USED Reportviewer control in C#.net(InBuild not Crystal report)
Is their are solution to pass parameter dynamically or same Solu is also used
plz reply me
Thank's
|
|
|
|
|
The example you were given, shows you how to pass parameters dynamically. Or, do you mean, pass which parameters to select, dynamically ? In that case, if you're building SQL, you just need to conditionally add the columns you want.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi all!
I want to change the height of a combobox in flat style, but I can't, Visual Studio 2005 resets the value back on a value depending on the used font size.
On a TextBox I can change the height (when property Multiline is false)
Has anybody an idea how I can afford this problem easily?
Thanks a lot
Jörg
|
|
|
|