|
Hi,
Is it possible to load up a GridView where all rows are in edit mode?
Thanks
|
|
|
|
|
Is this an ASP.NET question?
led mike
|
|
|
|
|
|
I have never been able to figure this oneout, or find anything that reliably worked, either.
i am trying to develope an app that uses a richtextbox for input, and has all the options that wordpad does. Now, i realise i may not be able to pull off each and every trick, but there is one in particular that is driving me crazy. in wirdpad, say I have this sentance:
Bold and Italic are font styles.
Now, something i can do very easily is switch individual selections back and forth between one font style and another, so this would be easy:
Bold and Italic are font styles.
the problem is, if i want to do this:
Bold and Italic are font styles.
i get one or the other, basically whichever i selected last. here is the code i am using. rtb is the RichTextBox:
private void btnBold_Click(object sender, EventArgs e)<br />
{<br />
if (rtb.SelectionFont.Bold)<br />
rtb.SelectionFont = new Font(rtb.SelectionFont.FontFamily, rtb.SelectionFont.Size, FontStyle.Regular);<br />
else<br />
rtb.SelectionFont = new Font(rtb.SelectionFont.FontFamily, rtb.SelectionFont.Size, FontStyle.Bold);<br />
rtb.Select();<br />
}<br />
<br />
private void btnItal_Click(object sender, EventArgs e)<br />
{<br />
if (rtb.SelectionFont.Italic)<br />
rtb.SelectionFont = new Font(rtb.SelectionFont.FontFamily, rtb.SelectionFont.Size, FontStyle.Regular);<br />
else<br />
rtb.SelectionFont = new Font(rtb.SelectionFont.FontFamily, rtb.SelectionFont.Size, FontStyle.Italic);<br />
rtb.Select();<br />
}
I am using C# express and the 2.0 framework. Any ideas?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
in each one u do not check if it's the other one.
if it is it resets the other one....
think about it.
|
|
|
|
|
Granted, that is true, but even if I just set it to italic or bold, like this:
private void btnBold_Click(object sender, EventArgs e)<br />
{<br />
rtb.SelectionFont = new Font(rtb.SelectionFont.FontFamily, rtb.SelectionFont.Size, FontStyle.Bold);<br />
rtb.Select();<br />
}<br />
<br />
private void btnItal_Click(object sender, EventArgs e)<br />
{<br />
rtb.SelectionFont = new Font(rtb.SelectionFont.FontFamily, rtb.SelectionFont.Size, FontStyle.Italic);<br />
rtb.Select();<br />
}
whatever the new fontstyle is, it overrides the existing one. So for example, i have this:
Short sentance
and i highlight like this:
Short se ntance
then try setting it to iatlics, rather than getting this:
Short sentance
i get this:
Short sentance
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Try something like this -->
this.richTextBox1.Text = "This is a test";
this.richTextBox1.SelectionStart = 0;
this.richTextBox1.SelectionLength = 7;
System.Drawing.Font currentFont = richTextBox1.SelectionFont;
System.Drawing.FontStyle newFontStyle;
newFontStyle = FontStyle.Bold;
richTextBox1.SelectionFont = new System.Drawing.Font(currentFont.FontFamily, currentFont.Size, newFontStyle);
currentFont = richTextBox1.SelectionFont;
this.richTextBox1.SelectionStart = 5;
this.richTextBox1.SelectionLength = 3;
newFontStyle = FontStyle.Italic | FontStyle.Bold;
richTextBox1.SelectionFont = new System.Drawing.Font(currentFont.FontFamily, currentFont.Size, newFontStyle);
It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.
|
|
|
|
|
Awesome! That certainly got me going in the right direction. Its almost emberassing how long i have tried to get this working....
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Glad to help.
It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.
|
|
|
|
|
i have a dataview it has several rows
how can i pass thes rows to a datatable?
thanks for help
MD_NADA
|
|
|
|
|
Isn't your DataView based on a table already?
|
|
|
|
|
my dataview is aleady based on dataset but i filter the dataset by dataview
and i want to get the rows in the dataview in datatable
thanks for your help
MD_NADA
|
|
|
|
|
What do you mean when you say filter? Also, does the datagrid contain child rows? Why dont you just use your dataset if these rows are already there?
|
|
|
|
|
My application pulls data from a MySQL database and saves it as CSV file.
I have to localize this. the main requirement is that date and number format should be localized while making the CSV file.
for ex in German, the delimiter should be ";" instead of " ," . and numbers should have , in place of decimal(1.23 should be 1, 23) and also the date should be in correct format.
now the data I am pulling could be of any type, string, single, double, how can I know the type of pulled data, and format it for the installed UI culture before saving it to the CSV file.
I know that I can find out the type of the column pulled, and use that, is there a better an efficient way ?
Any ideas ?
Thanks,
Arti
|
|
|
|
|
IMHO the most simple solution will be to write data in binary mode. After that data will be automatically reformatted according to local settings of the target computer while reading.
|
|
|
|
|
I am having a problem I am not sure why is hapening. In the following code, if I put the line with the Clone() method before the this.datagridSplit.Panel2.Controls.Add(dataGrid); it works well but I get the error No parameterless constructor defined for this object in a MissingMethodException. My guess is that is because the object is occupied on another thread but I am not sure. Note that when the dataGrid is added to a control I fire another event that modifies the bound table of the datagrid. What a day!
public void SetFinder(ref ComplexObject finderObject) //Type ComplexObject is a typed dataset
{
finderObject.Read();
complexObject = finderObject;
dataGrid = finderObject.FinderDatagrid;
dataGrid.ColumnHeadersVisible = false;
this.datagridSplit.Panel2.Controls.Add(dataGrid);
emptyDataSet = finderObject.Clone();
emptyDataSet.EnforceConstraints = false;
emptyDataSet.Tables[0].Rows.Add(null, null);
emptyDataSet.AcceptChanges();
emptyDataGrid.DataSource = emptyDataSet.Tables[0];
emptyDataGrid.AllowUserToAddRows = false;
emptyDataGrid.Dock = DockStyle.Fill;
emptyDataGrid.RowHeadersVisible = false;
this.datagridSplit.Panel1.Controls.Add(emptyDataGrid);
this.emptyDataGrid.CellValueChanged += new DataGridViewCellEventHandler(emptyDataGrid_CellValueChanged);
this.emptyDataGrid.CellLeave += new DataGridViewCellEventHandler(emptyDataGrid_CellLeave);
}
|
|
|
|
|
Hi
please help me in this:
I have loaded xml document using following DOM class:
<br />
<br />
XmlDocument xDoc = new XmlDocument();<br />
<br />
xDoc.Load("check.xml");<br />
<br />
Now how can i view this xml file similar to internet explorer display?
Either i should draw Rich Text Box or drop WebControl on my the form? I have added WebControl in toolbox but it is disable there.
please help me.
Thank you.
|
|
|
|
|
You mean the control is disabled in your toolbox ?
Cross my heart, smack me dead...stick a lobster on my head.
|
|
|
|
|
Yes here in mine toolbox
|
|
|
|
|
Is there a way to create a program that will constantly update what programs the current user is using? I tried using GetCurrentProcess, but it gets my window, and not the currently activated window. What I do is, I have a thread that will keep watching the processes, calling the GetCurrentProcess function to constantly update. This thread only activates when the form is "deactivated". The problem is that I just keep getting my app, and not the other processes.
|
|
|
|
|
To get all processes running on the local computer.
Process [] localAll = Process.GetProcesses();
Every running process is a current process. GetCurrentProcess retrieves whatever process the method is being run within. It sounds like what you really want to know is which application currently has the keyboard focus. For that you would use GetForegroundWindow (See: MSDN Forums-- Visual C#-- Visual C# General-- How do I determine which program window is active?[^])
However, if you are interested in currently running processes, you could use WMI to get a list, and notify you whenever a new process is created.
See this article: System.Management Lets You Take Advantage of WMI APIs within Managed Code[^]
using System;
using System.Management;
namespace WorkWithProcesses
{
class Class1
{
static void Main(string[] args)
{
ManagementClass processClass = new ManagementClass
(@"root\cimv2:Win32_Process");
foreach (ManagementObject processInstance in
processClass.GetInstances())
{
Console.WriteLine(processInstance["Caption"].ToString());
}
ManagementEventWatcher watcher = new ManagementEventWatcher (
new WqlEventQuery ("SELECT * FROM __InstanceCreationEvent
WITHIN 1 " +
@"WHERE TargetInstance ISA ""Win32_Process"""));
EventHandler handler = new EventHandler();
watcher.EventArrived += new EventArrivedEventHandler
(handler.Arrived);
watcher.Start();
System.Threading.Thread.Sleep(180000);
watcher.Stop();
Console.WriteLine("Done watching for events");
}
}
public class EventHandler
{
public void Arrived(object sender, EventArrivedEventArgs e)
{
Console.WriteLine("Process created = " +
((ManagementBaseObject)e.NewEvent["TargetInstance"])["Caption"]);
}
}
}
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
I am getting the following error when trying to compile this code:
H:\Grid Project\Alchemi-1.0.4-src\src\Alchemi.ManagerServiceController\ManagerMainForm.cs(61): 'ManagerTemplateForm.components' is inaccessible due to its protection level
Here is the code that I am working with. I have a comment on the line where the error is thrown.
#region Alchemi copyright and license notice
#endregion
using System;
using System.ComponentModel;
using System.Reflection;
using System.ServiceProcess;
using System.Threading;
using System.Windows.Forms;
using Alchemi.Core;
using Alchemi.Core.Manager;
using Alchemi.Manager;
using log4net;
[assembly: log4net.Config.XmlConfigurator(Watch=true)]
namespace Alchemi.ManagerService
{
public class ManagerMainForm : ManagerTemplateForm
{
public const string serviceName = "Alchemi Manager Service";
public ManagerMainForm():base()
{
InitializeComponent();
this.Text = "Alchemi Manager Service Controller";
Logger.LogHandler += new LogEventHandler(LogHandler);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container(); <big></big>
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ManagerMainForm));
this.SuspendLayout();
this.cbIntermediate.CheckedChanged += new System.EventHandler(this.cbIntermediate_CheckedChanged);
this.Name = "ManagerMainForm";
this.Text = "Alchemi Manager";
this.Load += new System.EventHandler(this.ManagerMainForm_Load);
this.ResumeLayout(false);
}
#endregion
private void LogHandler(object sender, LogEventArgs e)
{
ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
switch (e.Level)
{
case LogLevel.Debug:
string message = e.Source + ":" + e.Member + " - " + e.Message;
logger.Debug(message,e.Exception);
break;
case LogLevel.Info:
logger.Info(e.Message);
break;
case LogLevel.Error:
logger.Error(e.Message,e.Exception);
break;
case LogLevel.Warn:
logger.Warn(e.Message, e.Exception);
break;
}
}
private void ManagerMainForm_Load(object sender, EventArgs e)
{
ReadManagerConfig(false);
RefreshUIControls();
btStart.Focus();
}
private void ReadManagerConfig(bool useDefault)
{
ManagerContainer mc = new ManagerContainer();
mc.ReadConfig(useDefault);
Config = mc.Config;
mc = null;
}
private void cbIntermediate_CheckedChanged(object sender, EventArgs e)
{
Config.Intermediate = cbIntermediate.Checked;
_container.Config = Config;
RefreshUIControls();
}
#region Implementation of methods from ManagerTemplateForm
protected override bool Started
{
get
{
bool started = false;
try
{
ServiceController sc = new ServiceController(serviceName);
if (sc.Status == ServiceControllerStatus.Running || sc.Status == ServiceControllerStatus.StartPending)
{
started = true;
}
sc = null;
}
catch (Exception ex)
{
logger.Error("Error trying to determine service status",ex);
}
return started;
}
}
protected override void Exit()
{
this.Close();
Application.Exit();
}
protected override void ResetManager()
{
ReadManagerConfig(true);
RefreshUIControls();
}
protected override void StopManager()
{
if (!Started)
{
Log("The Manager Service is already stopped.");
RefreshUIControls();
return;
}
try
{
statusBar.Text = "Stopping Manager Service...";
Log("Stopping Manager Service...");
btStop.Enabled = false;
ServiceController sc = new ServiceController(serviceName);
if (sc.CanStop)
{
sc.Stop();
sc.WaitForStatus(ServiceControllerStatus.Stopped,new TimeSpan(0,0,28));
Log("Manager Service stopped.");
}
else
{
logger.Debug("Couldnot stop service: CanStop = false");
}
}
catch (TimeoutException)
{
Log("Timeout expired trying to stop Manager Service.");
}
catch (Exception ex)
{
Log("Error stopping ManagerService");
logger.Error(ex.Message, ex);
}
RefreshUIControls();
}
protected override void StartManager()
{
if (Started)
{
Log("Manager Service is already started.");
RefreshUIControls();
return;
}
try
{
btStart.Enabled = false;
btReset.Enabled = false;
btStop.Enabled = false;
statusBar.Text = "Starting Manager Service...";
Log("Attempting to start Manager Service...");
ServiceController sc = new ServiceController(serviceName);
if (sc.Status != ServiceControllerStatus.Running && sc.Status != ServiceControllerStatus.StartPending)
{
Config = GetConfigFromUI();
if (Config!=null)
{
Config.Slz();
}
sc.Start();
sc.WaitForStatus(ServiceControllerStatus.Running,new TimeSpan(0,0,28));
Log("Manager Service started.");
}
}
catch (TimeoutException)
{
Log("Timeout expired trying to start Manager Service.");
}
catch (Exception ex)
{
Log("Error starting ManagerService");
logger.Error("Error starting ManagerService",ex);
StopManager();
}
RefreshUIControls();
}
#endregion
}
}
|
|
|
|
|
there are two possibilities which mean the same...
1. you forgot to specify the protection level of the component field in your managertemplateform which means by default that it is set to private
2. you didn't forget it but specify it to private...
Then if you want it to be not accessible by other class than children of the managertemplateform, you specify the protection level to protected...
if you agree that any classes access to it, choose public.
enjoy the code with you is my priority,
Blaise Braye
|
|
|
|
|
Hi every one
I wanted to know how to select Datagridview certain cell.. and highlight it..
for example.. Cell(ColumnIndex, RowIndex).. and then Highlight the cell...
I wanted also to highlight multiple cells.. and color different cells... I'm stuck with this problem for 2 days already..
some one told me about DataGridViewCell.Selected Property.. but i don't know how to use it to solve my problem
so please I need your help urgently...
I'm really appreciated for any hint..
Thanks in advance..
|
|
|
|
|
have you tried row.Cell[x].Style or row.DefaultCellStyle ?
|
|
|
|
|