|
Hi,
Here at work we have a module in C++ which takes text out of the database and puts in a Word document which is loaded with a template.
I have to do about the same and I think it's a bad idea meddling with the existing code. (for numerous reasons; it's poorely designed and is half integrated with another program etc...)
Is it hard to create a C# module which would do about the same? It would be used for a demo so nothing fancy. If I have the document as a file, that would be enough to print it I think.
Any ideas were to start looking? (articles? MSDN? Code? Anything)
tnx!
No hurries, no worries.
|
|
|
|
|
I am not so sure, but crystal reports may help you in desinging documents
|
|
|
|
|
hi
i write a web application with c#.
it has some pages and thir controls such as:
validators , datagrid , datalist with template column
and they have thir event handler functions.
the application works correctly on local.
{ my system: [windows 2003 server ]}
but when i upload it to the host server , the events dont work correctly.
------------
site address:http://siteavval.com/WebVDir/MainGrps.aspx
error message for:
javascript:__doPostBack('MainGrpsList$_ctl0$LBGrpShr','')
|
|
|
|
|
I have an xml file that i'm outputing to a textbox. I have a button that is supposed to go to the next node ach time i click it. I know how to output a whole xml file but, i just want to output each node's content with the click of the button.
|
|
|
|
|
You'll have to elaborate. If you're displaying the entire XML text in a TextBox , then how do you "go to the next node"? You're already displaying all nodes in the TextBox .
Parsing XML, in general, is very easy and there's many ways to do it, from reading the whole file into memory using the XML Document Object Model (DOM) to fast forward-only parsing (SAX, or SAX-like behavior). For forward-only behavior, use an XmlTextRead , move to the first child node of the document element (root node), and keep moving to the next sibling node:
using System;
using System.IO;
using System.Xml;
class Test
{
const string xml = @"<?xml version=""1.0""?>
<root>
<child>
<text1>Hello</text1>
<text2>World</text2>
</child>
<child>
<text1>Howdy</text1>
<text2>Earth</text2>
</child>
</root>";
static void Main()
{
using (StringReader sr = new StringReader(xml))
{
XmlTextReader reader = new XmlTextReader(sr);
while (reader.Read())
{
if (reader.Name == "child")
{
Console.WriteLine(reader.ReadOuterXml());
Console.WriteLine("----------");
}
}
}
}
} You could use an XmlDocument to load the whole document into memory and walk the DOM. Again, it really just depends on your requirements.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Does anyone know how to highlight a row of text in a richTextBox control.
|
|
|
|
|
If you look at the member documentation[^] for the RichTextBox class in the .NET Framework SDK, you'll find several properties that begin with Selection* or Selected* . Many of those properties give you several different ways of selecting text based on what you want to do.
Keep in mind that there's not really a row, though. There are paragraphs that are wrapped and "rows" are formed by whatever words fit within the current width of the RichTextBox . The RichTextBox already does this, though, if you click the far left edge of the control. In applications like WordPad (which use the Rich-Edit control, which the RichTextBox class in .NET encapsulates), the margins are set wider so that it's easier to click and select a line. To do the same in your RichTextBox , set its ShowSelectionMargin property to true .
using System;
using System.Drawing;
using System.Windows.Forms;
class Test : Form
{
static void Main()
{
Application.Run(new Test());
}
Test()
{
RichTextBox rt = new RichTextBox();
Controls.Add(rt);
rt.Dock = DockStyle.Fill;
rt.ShowSelectionMargin = true;
Text = "Test";
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi all
I am using Microsoft FlexGrid (Com Component) in a desktop application(.Net). Using Globalization i am displaying Chinese characters. It is displaying in the labels and messages. But when i am trying to display in the MS FlexGrid it is showing "????" Qestion marks. Can any one help me how will I display Chinese characters in Microsoft Flex Grid.
Thank you
arun
Arun Kumar Sabat
Bangalore
India
|
|
|
|
|
Hi,
How do i know whether the files that are added to the project
are added by File reference or project reference ??
Any help will be great.
Saleem
|
|
|
|
|
There's no way to no just from looking for sure. If the file path (in the PropertyGrid) of a reference references a file in the obj\Debug or obj\Release directory, than it's probably a Project reference. If you switch configurations and the reference is still set to obj\Debug or obj\Release (which it was before), then it's very likely it's a File reference. If the path is somewhere outside a Visual Studio project directory then it's probably a File reference.
When in doubt, remove the reference and re-add it appropriately.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello everyone,
I want to make a datagrid which has a column of Checkbox. By using DataGridBoolColumn class, I have done this. But, When my Application starts, the CheckBox Column will be in the checkstate of "Indeterminate". I want it to be "Uncheked". The CheckBox Control has an Attribute of CheckState, but DataGridBoolColumn hasn't this Attribute. How can i do this? Please help me.
A segment of my code:
DataGridTableStyle dgt = new DataGridTableStyle();
dgt.MappingName = "ok";
DataGridTextBoxColumn dgtbc = new DataGridTextBoxColumn();
dgtbc.MappingName = "Name";
dgtbc.HeaderText= "Name";
dgt.GridColumnStyles.Add(dgtbc);
dgtbc = new DataGridTextBoxColumn();
dgtbc.MappingName = "ID";
dgtbc.HeaderText= "ID";
dgt.GridColumnStyles.Add(dgtbc);
DataGridBoolColumn dgbc = new DataGridBoolColumn();
dgbc.MappingName = "Check";
dgbc.HeaderText = "Check";
dgbc.AllowNull = false;
dgbc.FalseValue = false;
dgbc.TrueValue = true;
dgt.GridColumnStyles.Add(dgbc);
this.dataGrid1.TableStyles.Clear();
this.dataGrid1.TableStyles.Add(dgt);
hope for help
|
|
|
|
|
Hi,
Try using System.Boolean DataColumn for the Checkbox column. I think this would do the job for you. Or else, check if you can set the Checkbox to 2 way input mode. Ie., Just True/False. There is a method to do it. I think it is by setting the ObjGridColumnStyle.NullText = ""; Try it, and let me know if it worked.
- Titan
Titan Williams
Sr. Systems Engineer
Indian
|
|
|
|
|
Hi Titan Williams,
The CheckBox Column in my program has been set to bool. In addition, the CheckBox column has only two states true/false by using the property AllowNull = false. But It doesn't work!
I don't find ObjGridColumnStyle class which you said.
Thanks for your reply. Can you have another method?
welspring
hope for help
|
|
|
|
|
Hi,
Try using System.Boolean DataColumn for the Checkbox column. I think this would do the job for you. Or else, check if you can set the Checkbox to 2 way input mode. Ie., Just True/False. There is a method to do it. I think it is by setting the ObjGridColumnStyle.NullText = ""; Try it, and let me know if it worked.
- Titan
Titan Williams
Sr. Systems Engineer
Indian
|
|
|
|
|
You didn't mention if you're binding the DataGrid at this point in your application's lifetime yet. If not, it will be indeterminate since there's no data backing it. If you have bound the DataGrid , then 1) make sure the DataColumn specifies a boolean data type and that you set the TrueValue and FalseValue properties of the DataGridBoolColumn if the defaults aren't sufficient (they are for SQL Server).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
Thanks for your reply! I think you are right for the reason that there are no data in the CheckBox datacolumn of the datatable backgrounded. I have solved the problem by filling data to the datacolumn.
Another problem is, when clicked in the end of the datagrid, a new row will be created. The CheckBox column of the new row will still be in indeterminate state. How to resolve this?
Thanks again.
Welspring
hope for help
|
|
|
|
|
It's in an indeterminate state because there's no actual data row created yet. If you want to default the value, you should either add a DataColumn to your DataSet with the DefaultValue property set, or do this a better way by creating a typed DataSet in the designer, which also facilitates data-bound control design in VS.NET as well as typed access to fields in your code editor. Read Generating a Strongly Typed DataSet[^] in the .NET Framework SDK, as well as ADO.NET Datasets[^] in the Visual Studio .NET product documentation for information about how to create typed DataSet s using the component designer (slick).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanks a lot!
hope for help
|
|
|
|
|
To make this Yes or No do this: Make the 'Default' value in the corresponding column in the dataset table to Y or N.
I did this and it worked.
E.g. this.dsD_A_T_A_S_E_T1.EMP.PERM_EMPColumn.DefaultValue = "N";
I am of course using a 'typed dataset'. You can do this for normal datasets also.Like this:
this.dsD_A_T_A_S_E_T1.Tables["EMP"].Columns["PERM_EMP"].DefaultValue = "N";
How this helps
|
|
|
|
|
I have pulldown menu and I've assigned a DataSet as it's DataSource. Everything works great. At some point in my application I would like to assign a different DataSet to be its DataSource but for some reason its not working; I'm still seeing data from my first DataSet. I've tried assigning the DataSource property a null and then assigning my new DataSet but to no avail. What am I doing wrong ? Thanks in advance...
-Pete
|
|
|
|
|
You can use null then can bind the next datasource. But it seems that you already tried that. Ok. just call Refresh() methos of your control just before binding second datasource.;)
Sreejith Nair
[ My Articles ]
|
|
|
|
|
I need a little guidance on a multithreaded application. The idea of the app is to have a machine send UDP packets to a server and the server will retrive the packets, parse out the data, and submit to a DB. I am initially looking at this as a multithreaded approach with the server being separated into 2 threads: 1) UDP retrieval, and place message into message queue, 2) send message from queue to DB.
i.e.
Class retriever
{
public retrievemsg()
{
while(true)
{
lock(queue)
{
//retrieve message and place on queue
}
}
}
}
Class Sender
{
public sendToDB()
{
while(queue not empty)
{
lock(queue)
{
//send msg info to DB
}
}
}
}
While I understand the concepts of multithreading and concurrency and the such, what I am having trouble with is since the threads are basically always running how will the CPU know to switch threads to execute the one that needs processing. For example, the UDP packets are going to arrive pretty regularly, but we still want regular service of the packets and the infomration should show up regularly into the DB. I don't want to explicitly say Thread.Sleep(0) because I am not exactly sure when is the best time, or it could change. How would I synchronize the running of these threads.
Thanks ahead of time
|
|
|
|
|
Your problem is the typical Producer-Consumer problem. One thread writes to the queue and the thread needs to know when the queue is not empty. You can use the AutoResetEvent class or the Monitor class to do the synchronization. Typical code will look like
Class retriever
{
public retrievemsg()
{
while(true)
{
lock(queue)
{
queue.Add(msg);
Monitor.Pulse(queue);
}
}
}
}
class Sender
{
public sendToDB()
{
lock(queue)
{
while(true)
{
Monitor.Wait(queue);
Msg msg = queue.Remove(msg);
}
}
}
}
You can also use the AutoResetEvent to signal the Sender that a message has arrived. The Sender will WaitOne() on the event and once signalled, will fetch the item.
Regards
Senthil
My Blog
|
|
|
|
|
Just my $0.02
UDP? Shouldn't you be using TCP instead? UDP makes no guarantees about the packets getting to their destination, let alone the order in which they get there! If you're adding information to a database, usually you want consistancy in the data that's going into it. TCP would be a much better choice, particularly over the Internet.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I own a charting application with a horizontal scroll bar that can be slid from side-to-side to view the entire chart (normal scrolling action). This scroll bar also has a grip at each end that can be used to expand/shrink its length, and thus expand/shrink the scope of the current viewing area (resulting in a zoom-in, zoom-out action).
Is this dual-action scroll bar built from a set of "stock" functions in .NET, or does it require a fully customized approach?
I would like to recreate this control in C#, and I would appreciate any information or example(s) that could help get me started. Thanks.
|
|
|
|