|
That was very simple to get working, changes for the reassurance
modified 12-Jul-20 21:01pm.
|
|
|
|
|
hi
i have a method that return DataTable (named GetData), now i want to load returned DataTable object to DataSet by this code :
this.ds.Load(dal.GetData(cmd1).CreateDataReader(), LoadOption.OverwriteChanges, new string[] { "transaction1" });
but before, load data, i want to clear some tables of my dataset objects by this code :
this.ds.Tables[0].Clear();
but at runTime the following error has shown me :
Cannot find table 0
how to solve my problem and how to clear before fill ?
thanks
|
|
|
|
|
hdv212,
if (this.ds.Tables.Count != 0)
{
this.ds.Tables[0].Clear();
}
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
First check your dataset have any table. If not no need to clear.
kesavan
|
|
|
|
|
Hello All,
I have this one asp.net 2.0 project that throws the following error when I attempt to use System.Diagnostics.Debug.WriteLine
{"Couldn't create listener 'textWriterTraceListener'."} System.Exception {System.Configuration.ConfigurationErrorsException}
It has an interesting inner exception of:
InnerException {"Illegal characters in path."} System.Exception {System.ArgumentException}
All of the other asp.net 2.0 apps I have run perfectly fine with that statement and previous versions of this application ran fine. Any ideas?
Thanks in advance,
Ryan
|
|
|
|
|
RB@Emphasys,
Show us some code.
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
I'm not sure exactly what you're looking for, it's simply erroring out when attempting to writeline, but here is the if statement:
if (CertificationPerson_RaceTable.GetRecords("IsActive = 1 And fkPerson = " + oCertPersonRecord.PK).Length == 0)
{
System.Diagnostics.Debug.WriteLine(oCertPersonRecord.PK + " " + oCertPersonRecord.fkRace);
oPersonRaceRecord = new CertificationPerson_RaceRecord();
oPersonRaceRecord.fkPerson = oCertPersonRecord.PK;
oPersonRaceRecord.fkRace = oCertPersonRecord.fkRace;
oPersonRaceRecord.Save();
}
Thanks,
Ryan
|
|
|
|
|
Check your application settings (web.config). Sounds like it's trying to trace to a file but someone made a typo in the file name or path.
As in:
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="myListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="InvalidFileNameHere.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
I bolded the place to look for the error.
Peter the small turnip
(1) It Has To Work. --RFC 1925[^]
|
|
|
|
|
Thanks Peter,
That did the trick. I spaced out on that one....
Ryan
|
|
|
|
|
Hi all!
I create a class that extends UserControl, and so, I try to add some mouse events to the objects that my app creates dynamically.
It follows the class UserControlEx, the one that I created.
public class ControlEx : System.Windows.Forms.UserControl {
private bool isDragging = false;
private int clickOffsetX, clickOffsetY;
KineticaRT.Controls.Dial lblDragger;
public ControlEx (System.Windows.Forms.TabPage tabPage) {
this.lblDragger = new KineticaRT.Controls.Dial();
this.lblDragger.Enabled = true;
tabPage.Controls.Add(this.lblDragger);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(controlEx_MouseUp);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(controlEx_MouseMove);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(controlEx_MouseDown);
}
private void controlEx_MouseDown (System.Object sender, System.Windows.Forms.MouseEventArgs e) {
isDragging = true;
clickOffsetX = e.X;
clickOffsetY = e.Y;
}
private void controlEx_MouseUp (System.Object sender, System.Windows.Forms.MouseEventArgs e) {
isDragging = false;
}
private void controlEx_MouseMove (System.Object sender, System.Windows.Forms.MouseEventArgs e) {
if (isDragging == true) {
this.Left = e.X + this.Left - clickOffsetX;
this.Top = e.Y + this.Top - clickOffsetY;
}
}
private void InitializeComponent() {
this.SuspendLayout();
this.Name = "ControlEx";
this.ResumeLayout(false);
}
}
As you can see, the constructor of the class, creates the object and adds the events to the control(lblDragger).
But, a problem occurs. When I press the mouse down and I try to drag the object nothing occurs. The mouse up functions also does not work.
private ControlEx dial;
private void button1_Click(object sender, EventArgs e) {
if (tcDataPanes.TabCount == 0) {
TabPageEx tabpage = new TabPageEx(tcDataPanes);
}
dial = new ControlEx(tcDataPanes.SelectedTab);
}
How can I solve this problem?
Thank you in advance.
Gustavo
|
|
|
|
|
Hi.
I need to display some information in the system tray using the notifyicon control, but the the notifyicon control only allows me to draw on a 16*16 space but I need around 16*64 space, How can I do this?
|
|
|
|
|
4 icons maybe? Not sure how well that will work :p
|
|
|
|
|
As leppie's suggested, some tools display multiple icons, but you've got no way of guaranteeing that they'll be displayed in a particular order.
Can't you just open a small 64x64 topmost window above the system tray and display your info in that?
|
|
|
|
|
Hi.
Thanks for replying.
I was thinkning of using 4 notifyicons, but I think that this will increase my headache.
I think that I have to go to the small windows solution.
|
|
|
|
|
Hi guys. I'd like to simulate keyboard keystrokes and not everything is working.
I'm using Postmessage and Sendmessage API.
Sending a character is simple using PostMessage(handle, WM_KEYDOWN, key, IntPtr.Zero), but I can't simulate key combos like shift+1 or capslock+a. For the combos here's what I tried:
PostMessage(handle, WM_SYSKEYDOWN, VK_CAPITAL, new IntPtr(1));
PostMessage(handle, WM_KEYDOWN, VK_A, IntPtr.Zero);
PostMessage(handle, WM_KEYUP, VK_A, new IntPtr(1));
PostMessage(handle, WM_SYSKEYUP, VK_CAPITAL, new IntPtr(1));
|
|
|
|
|
Did you look at the SendKeys API in the .NET framework?
Life, family, faith: Give me a visit.
From my latest post: "And you think, 'To keep my anti-Judaic theology alive I must reinterpret this verse too as being a blessing for Christians and not for Jews. I know it strains all manner of principles of interpretation. I don’t read the newspaper this sloppily, but, man, I have a theology to defend.'"
Judah Himango
|
|
|
|
|
SendKeys.Send is the first thing I tried, but it was limited: I can't send ctrl+shift among other things.
|
|
|
|
|
xax wrote: I can't send ctrl+shift among other things.
You're wrong, you can send CTRL+Shift using SendKeys[^].
Life, family, faith: Give me a visit.
From my latest post: "And you think, 'To keep my anti-Judaic theology alive I must reinterpret this verse too as being a blessing for Christians and not for Jews. I know it strains all manner of principles of interpretation. I don’t read the newspaper this sloppily, but, man, I have a theology to defend.'"
Judah Himango
|
|
|
|
|
At the top of your class:
[DllImport("user32.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
Within your class you will need the following two methods:
private static void PressKey(byte keyCode)
{
keybd_event(keyCode, 0x45, 0, 0);
}
private static void ReleaseKey(byte keyCode)
{
keybd_event(keyCode, 0x45, 0x2, 0);
}
Simply send the correct keyCode to execute the press or release key method.
With these methods until the ReleaseKey method is called for a key it is held down by the PressKey method.
One word of warning - make sure you release all the pressed keys or wierd things will happen.
Regards
Guy
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
You'll give this a try. I've read that keybd_event is buggy.
Thanks.
|
|
|
|
|
xax wrote: I've read that keybd_event is buggy.
I hope not...
I use it in a commercial application I am developing for voice recognition.
I have had no problems in the testing environment with this.
The important bit is to make sure that you issue the keyRelease for all the keyPress(es).
Good luck.
Regards
Guy
P.S. I need to correct the information I gave you - when you issue the keyPress this counts as one keyPress.
This means that you may need to issue more than one keyPress for each key to keep it held down.
The way I get around this is I record the users keystrokes and play them back at the same rate that they were recorded.
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|
|
hello sir,
my application is on c# and i have give connection string according to
machine name in app.config
"server="+Environment.MachineName+"\\"+this.instancename()+" ;Trusted_Connection=yes; database="+this.databasename()+"; Pooling=false"
thanks in advance
|
|
|
|
|
monu_khan wrote: i have give connection string
Do you also have a question?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Application configuration files are designed to provide this information without undo coding. Use the connection strings block in the xml to add connection string keys and then have your application blindly read it and use it.
Individual machines are responsible for their own configuration settings and that is the entire point of application configuration files.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
actually my problem is that how to pass enviornment.machinename value
<add key="con" value="server=Enviornment.Machinename\INFOSOFT\ist;database=sm;user id=sa;pwd=****" />
|
|
|
|