|
Hey!
I am using:
<br />
rtIncomeLogg.HideSelection = false;<br />
rtIncomeLogg.SelectionStart = rtIncomeLogg.TextLength;<br />
rtIncomeLogg.ScrollToCaret();<br />
To scroll my RichTextBox.
The problem with this is that the area that the RichTextBox i showing is blank, not until i move the scroolbar i can se the data.
My fist thougt whas tat it was alot of \n that was appendet to the text, but is isent?
When i scrool(manual) up a bit then down again i can see that the text is reaching all the way down(the blank have disapared)?
I have also tryed this Code:
<br />
rtIncomeLogg.Focus();<br />
rtIncomeLogg.Select(rtIncomeLogg.TextLength, 1);<br />
rtIncomeLogg.Select();<br />
This works fine, BUT i need to be able to type in other controls while data is added to my richTextBox, and by using Focus on this richTextBox i can use any of the other text boxes to write in.
Do you know how to solve this problem?
Best Regards
SnowJim
|
|
|
|
|
if i use the first code i posted above:
and efter the data have been added and i only see the blank Rich text box with the vertical scroll bar at value MAX.
If i press the ^(Arrow up) on the vertical scoll bar once, then it shows the data in the text box and the scroll value is still set to value MAX.
Maby my problem could be fixed by fire the ^(arraow up) event on the scrollbar right after the scroll ToCaret is done?
But how do i fire this event?
Best Regards
SnowJim
|
|
|
|
|
Is there nowone that have any ides?
i cant use any APIs eather.
BestRegards
SnowJim
|
|
|
|
|
Is this a problem i will have to live with? or is there any solution to it? Maby its just me that haves this problem?
BestRegards
SnowJim
|
|
|
|
|
I tried the first code posted by you, it works fine in my sample program. I wonder what is the problem in your case, perhaps there is some other cause / code for the problem.
As for the second code, your problem is because you are selecting something (at least one character), which is preventing you to work in some other program while data is added to your richtextbox. In the second code, please try to use the following code (by selecting 0 character) and see whether it works (it works on my machine in my sample program):
rtIncomeLogg.HideSelection = false;
rtIncomeLogg.Select(rtIncomeLogg.TextLength, 0);
|
|
|
|
|
Thanks alot!
That code workt great!
But there is a smal problem! i want to switch the aouto scroll off, i have tested to do this
<br />
if (AUTOSCROLL)<br />
{<br />
rtIncomeLogg.HideSelection = false;<br />
rtIncomeLogg.Select(rtIncomeLogg.TextLength, 0);<br />
}<br />
else<br />
rtIncomeLogg.HideSelection = true;<br />
But the info in the text box becomes wary strange when data is still pasted in to it(from clipboard) in constant data flow?
Best Regards
SnowJim
|
|
|
|
|
Hello,
I want to pass a custom data type to a webmethod and get a custom data from a webmethod. The custom classes are on serverside. How can i include these classes to the client.
What should i do?
|
|
|
|
|
i there ,
i have a datagrid an he is bind to dataset
in the form load i all get all my customer table into the grid
i have also a dataview filter
when i filter i all geeting the desiers rows into the grid an every thing is o.k
but when i sending the dataset to crystal report i still geeting all of the rows that load in the formload
how can i make that just the filterd row will be in the dataset ?
thanks ....
|
|
|
|
|
Well, I would follow these steps:
1. Construct a new dataTable with the same structure of your customer's table (there's method allowing you to do this -that I can't remember from the top of my head right now- and also gives you the option to select if you want to copy the data or not. Don't).
2. Copy only the data that you filtered from your customer's table into the new table. To do this, use the same condition that you used for filtering the data in the customer's table.
3. Bound this new table (that contains only your filtered data) to the report instead.
Hope this helps.
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
This is my code:
this.oracleConnection1.ConnectionString = "user id=HMS;data source=HMS2005;password=HMS";
da = new System.Data.OracleClient.OracleDataAdapter();
cmd = new System.Data.OracleClient.OracleCommand("select A1,A2 from TEST",oracleConnection1);
da.SelectCommand = cmd;
cb = new System.Data.OracleClient.OracleCommandBuilder(da);
daset =new DataSet();
da.Fill(daset);
daset.Tables[0].Rows[0][0]= "123";
da.Update(daset);
So When My program was run . it throw one error and error message is
"Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information."
Help me!!!!!!!!!!
|
|
|
|
|
|
Hello,
I'm looking for a mail api written in c# like there is from sun for java.
I found CSMail, but is there an other one which is open source and perhaps better?
|
|
|
|
|
i'm create a window form for searching, but i don't know how to do that. There are so many condidions of searching on the form. Users usually don't enter all the fields on the form. So i create a sql query and in where clause condition i use 'AND' operator to combine all conditions of searching and the result will show nothing because some conditions of searching have been blank.
So do i create a sql query or many sql queries for searching
Any suggestion
Thanks
It may be a stupid question because i'm too
|
|
|
|
|
vuthaianh wrote:
It may be a stupid question because i'm too
There's no such thing as a stupid question. I think that you would stupid if u never asked. So don't worry about that.
Dynamically constructing an SQL statement is a quite good way to do it actually. To solve the problem you are facing I would either:
(1) Force the users to fill in all the fields (which is not what you are after as u said)
(2) Check for the blank fields and just avoid inserting an "AND" operator for them into your SQL statement. Only handle the fields that were filled by the user.
Hope this helps.
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thanks for answering my question
Actually i intended to write a stored procedure to serve for searching, and in the stored procedure i must pass as many parameters as the the stored procedure requires
So if users left one of these fields on the form blank, the stored procedure will be useless. it will show nothing
Once again thanks so much
|
|
|
|
|
Thanks for answering my question
Actually i intended to write a stored procedure to serve for searching, and in the stored procedure i must pass as many parameters as the the stored procedure requires
So if users left one of these fields on the form blank, the stored procedure will be useless. it will show nothing
Once again thanks so much
|
|
|
|
|
Im trying to get the file properties dialog to show for multiple files from within my application. So far ive got something that looks like this:
[StructLayout(LayoutKind.Sequential)]
public class SHELLEXECUTEINFO
{
public int cbSize;
public int fMask;
public IntPtr hwnd;
[MarshalAs(UnmanagedType.LPWStr)]
public string lpVerb;
[MarshalAs(UnmanagedType.LPWStr)]
public string lpFile;
[MarshalAs(UnmanagedType.LPWStr)]
public string lpParameters;
[MarshalAs(UnmanagedType.LPWStr)]
public string lpDirectory;
public int nShow;
public int hInstApp;
public int lpIDList;
public string lpClass;
public int hkeyClass;
public int dwHotKey;
public int hIcon;
public int hProcess;
}
public const int SEE_MASK_INVOKEIDLIST = 0xC;
public const int SEE_MASK_NOCLOSEPROCESS = 0x40;
public const int SEE_MASK_FLAG_NO_UI = 0x400;
[DllImport("shell32.dll", CharSet=CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern int ShellExecuteEx(SHELLEXECUTEINFO SEI);
SHELLEXECUTEINFO SEI = new SHELLEXECUTEINFO();
int iReturn;
//set a filename
string strFilename = "c:\\ReadMe.txt";
//set up the structure
SEI.cbSize = Marshal.SizeOf(SEI);
SEI.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_INVOKEIDLIST | SEE_MASK_FLAG_NO_UI;
SEI.hwnd = this.Handle;
SEI.lpVerb = "properties";
SEI.lpFile = strFilename;
SEI.lpParameters = "\0";
SEI.lpDirectory = "\0";
SEI.nShow = 0;
SEI.hInstApp = 0;
SEI.lpIDList = 0;
iReturn = ShellExecuteEx(SEI);
How can i get it to work for multiple files?
|
|
|
|
|
|
I can only find info on displaying for 1 file.
|
|
|
|
|
I am attempting to write a command queue. It is important that each command is executed in order (FIFO). This command queue will be running functions that will have to interact with controls using Control.Invoke . The problem I am having has to do with threading and is harder to describe then to show. Code Follows:
public struct CommandContainer
{
public System.Delegate method;
public object[] parameters;
}
CommandQueue.cs
-------------------------
using System;
using System.Threading;
using System.Windows.Forms;
namespace CommandQueue
{
public delegate void CommandFunction();
public class CommandQueue:System.Collections.Queue
{
private ManualResetEvent m_ManualResetEvent;
public CommandQueue()
{
}
public override void Clear()
{
lock(this.SyncRoot)
{
base.Clear ();
}
}
public override object Dequeue()
{
lock(this.SyncRoot)
{
return base.Dequeue ();
}
}
public override object Peek()
{
lock(this.SyncRoot)
{
return base.Peek ();
}
}
public override void Enqueue(object obj)
{
lock(this.SyncRoot)
{
if(obj is CommandContainer)
{
base.Enqueue (obj);
}
else
{
}
}
}
public void Enqueue(CommandFunction target)
{
lock(this.SyncRoot)
{
CommandContainer t_CommandContainer;
t_CommandContainer.method = target;
t_CommandContainer.parameters = null;
base.Enqueue (t_CommandContainer);
}
}
public void Enqueue(System.Delegate method, object[] parameters)
{
lock(this.SyncRoot)
{
CommandContainer t_CommandContainer;
t_CommandContainer.method = method;
t_CommandContainer.parameters = parameters;
base.Enqueue (t_CommandContainer);
}
}
public void Flush()
{
Thread t_FlushThread = new Thread(new ThreadStart(FlushThreadStart));
t_FlushThread.Name = "Flush Thread";
t_FlushThread.Start();
t_FlushThread.Join();
}
private void FlushThreadStart()
{
lock(this.SyncRoot)
{
for(int i = 0; i < this.Count; i++)
{
Thread t_RunThread = new Thread(new ThreadStart(RunCommand));
t_RunThread.Name = i.ToString() + " : " + ((CommandContainer)base.Peek()).method.Method.ToString();
t_RunThread.Start();
t_RunThread.Join(500);
}
}
}
private void RunCommand()
{
object t_Command = base.Dequeue();
if(t_Command is CommandContainer)
{
CommandContainer t_CommandContainer = (CommandContainer)t_Command;
t_CommandContainer.method.DynamicInvoke(t_CommandContainer.parameters);
}
}
}
}
Form1.cs
----------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace CommandQueue
{
public class Form1 : System.Windows.Forms.Form
{
CommandQueue CQ = new CommandQueue();
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
this.button1.Location = new System.Drawing.Point(8, 8);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(72, 40);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
[MTAThread]
static void Main()
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
for(int i =0; i< 2; i++)
{
CQ.Enqueue(new CommandFunction(Fctn0));
CQ.Enqueue(new CommandFunction(Fctn1));
CQ.Enqueue(new CommandFunction(Fctn2));
CQ.Enqueue(new CommandFunction(Fctn3));
}
CQ.Flush();
}
private void Fctn0()
{
Console.WriteLine("0");
}
private void Fctn1()
{
Console.WriteLine("1A");
this.button1.Invoke(new CommandFunction(foo));
Console.WriteLine("1B");
}
private void Fctn2()
{
Console.WriteLine("2");
}
private void Fctn3()
{
Console.WriteLine("3");
}
private void foo()
{
Console.WriteLine("Foo invoked from Fctn1");
}
}
}
OUTPUT:
The thread '0 : Void Fctn0()' (0x5f0) has exited with code 0 (0x0).
0
1A
The thread '2 : Void Fctn2()' (0x878) has exited with code 0 (0x0).
2
3
The thread '3 : Void Fctn3()' (0x894) has exited with code 0 (0x0).
The thread 'Flush Thread' (0x8d4) has exited with code 0 (0x0).
The thread '1 : Void Fctn1()' (0x54c) has exited with code 0 (0x0).
Foo invoked from Fctn1
1B
The problem is in function Fctn1() of Form1. It should output a “1A” followed by a “1B” in the console. Instead the Invoke call in Fctn1() appears to be voiding the Join(500) Call in FlushThreadStart() of CommandQueue.cs. I don’t care if the invoked code executes immediately, but why is the rest of the function waiting and how is it getting past the Join? Using a ManualResetEvent causes a deadlock. Any help would be appreciated.
|
|
|
|
|
It simply means that Invoke took more than 500 ms and so the FlushThreadStart continued to execute other functions while Fctn1 was waiting for the Invoke to complete.
I don't understand why you are running each command in a separate thread. You said that you want to execute them in the same order, so instead of starting a thread and then waiting for it to complete, why not just execute it synchronously?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I guess I thought Join(500) would kill the thread after 500ms. I must have misread that somewhere.
|
|
|
|
|
criteria exams=50% quizzes=10% daily= 10% assignments= 30%
this is the program I would like to revise
include<stdio.h>
void main (void)
{
double gpa,exam,quiz,assign,prof;
printf("\n enter the exam grade:");
scanf("%lf", &exam);
printf("\n enter the quiz grade:");
scanf("%lf",& quiz);
printf("\n enter the assign grade:");
scanf("%lf",& assign);
printf("\n enter the prof grade:");
scanf("%lf",& prof);
gpa=((exam*.6)+(quiz*.1)+(assign*.2)+(prof*.1));
printf("\n the gpa is %.2lf", gpa);
}
|
|
|
|
|
This is the C# Forum, not C++...
You might want to actually ask a question with whatever your having a problem with. DO NOT just say you want to revise this program. Since this is a homework project, you actually have to write the code. We'll help you with any problems your having, but will NOT write the code for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
What Dave said. Your code is also not valid C++, it returns void instead of int. That your compiler sucks is no excuse
Christian Graus - Microsoft MVP - C++
|
|
|
|