|
With all respect sir plz,
The thing is its a very small firm in which i m working, & have no senior to help. on my own i tried every possible way,
All is fine(Acc. to me), only the editing or modifying the text creates problem.
if user enter 3-4 lines:
"This is trial message plz ignore.
This is trial message plz ignore.
This is trial message plz ignore.
This is trial message plz ignore."
and now when user comes back to first line and enter some data in between, then the problem starts,
plz sir
private void txtBody_TextChanged(object sender, System.EventArgs e)
{
#region "wrap"
string[] tempArray = new string [txtBody.Lines.Length];
tempArray = txtBody.Lines;
int PrevSel = txtBody.SelectionStart;
string Op = "";
int maxLength = Convert.ToInt32(textBox1.Text);
bool change= false;
for(int cou = 0; cou < tempArray.Length ; cou++)
{
if (tempArray[cou].Length > maxLength)
{
string[] words = tempArray[cou].Split(' ');
int currentLineLength = 0;
string currentLine = "";
foreach(string currentWord in words)
{
if(currentWord.Length >= 0)
{
if(currentWord.Length >= maxLength)
{
Op += currentWord.Insert(maxLength, "\r\n");
break;
}
if(currentLineLength + currentWord.Length + 1 < maxLength)
{
currentLine += currentWord + " ";
currentLineLength += currentWord.Length +1;
}
else
{
Op +=currentLine.Insert(currentLineLength, "\r\n");
currentLine = currentWord + " ";
currentLineLength = currentWord.Length;
}
}
}
if(currentLine !="")
Op += currentLine;
PrevSel++;
change = true;
}
else
{
Op += tempArray[cou] + "\r\n";
}
if(change)
{
txtBody.Text = Op;
txtBody.SelectionStart = PrevSel;
}
}
#endregion
}
|
|
|
|
|
You do know that people are going to tell you that you should do your homework yourself don't you?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I have date in the format dd/mm/yyyy and I want to convert it to mm/dd/yyyy fromat as DateTime datatype,
I hope you understood the problem, please help me in solving this...
Prahsant V C
|
|
|
|
|
try to use DateTime.Parse(...);
|
|
|
|
|
And I need a hand in this
tree_Level.Nodes.Clear();
for (int x = 0; x < dataSet1.COMMS.Rows.Count; x++)
{
tree_Level.Nodes.Add(dataSet1.COMMS.Rows[x]["COMM_NAME"].ToString() + "_" + dataSet1.COMMS.Rows[x]["COMM_ID"].ToString(), dataSet1.COMMS.Rows[x]["COMM_NAME"].ToString(), 0, 0);
for (int y = 0; y < dataSet1.UZL.Rows.Count; y++)
{
if (dataSet1.UZL.Rows[y]["UZ_COMM_ID"].ToString() == dataSet1.COMMS.Rows[x]["COMM_ID"].ToString())
{
tree_Level.Nodes[x].Nodes.Add(dataSet1.UZL.Rows[y]["UZ_NAME"].ToString() + "_" + dataSet1.UZL.Rows[y]["UZ_ID"].ToString(), dataSet1.UZL.Rows[y]["UZ_NAME"].ToString(), 1, 1);
for (int z = 0; z < dataSet1.VILS.Rows.Count; z++)
{
if (dataSet1.VILS.Rows[z]["VIL_UZ_ID"].ToString() == dataSet1.UZL.Rows[y]["UZ_ID"].ToString())
tree_Level.Nodes[x].Nodes[0].Nodes.Add(dataSet1.VILS.Rows[z]["VIL_NAME"].ToString() + "_" + dataSet1.VILS.Rows[z]["VIL_ID"].ToString(), dataSet1.VILS.Rows[z]["VIL_NAME"].ToString(), 2, 2);
}
}
}
}
The last level in the loop is not doing fine (it puts all the second level subordinates under one node that is the first node in level two
ps. I know it's a mess but please just focus on the two inner nested loops.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
It's failing because you are assigning your new node at Nodes[x].Nodes[0] which will always be the same node under [x]. To get round this, change it to Nodes[x].Node[y], or better still maintain this via explicit TreeNodes.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks a bunch pete
Pete O`Hanlon wrote: explicit TreeNodes.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Muammar© wrote: Pete O`Hanlon wrote:
explicit TreeNodes.
TreeNode outerNode = new TreeNode("MyValue");
tree_list.Nodes.Add(outerNode);
TreeNode innerNode = new TreeNode("Inner item");
outerNode.Nodes.Add(innerNode);
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi my name is Zahid. Is it possible to use gSOAP with C#? If yes then please tell me how.
|
|
|
|
|
Hi,
I want to add facility to Cab and UnCAB files from my application being developed in c# 2005. how can i archive this. ?? please help..
thnks
|
|
|
|
|
|
|
Is Crystal Report tools is not come with .Net Framework at the time of installation?
Please help me.
Arun Kr
|
|
|
|
|
Try that again without the use of double-negatives.
Does Crystal Reports come with the .NET Framework?
or
Is this right? Crystal Reports does not come with the .NET framework?
You see - 1 negative per question.
|
|
|
|
|
He seems to be pessimistically optimistic.
(-1) * (-1) = (1) right?
|
|
|
|
|
Hey,
This XML stuff drives me crazy (almost)
I have a string with the following XML
<object class="user" name="admin2@test.dk" xmlns="">
<property name="cn">
<value>admin2@test.dk</value>
</property>
<property name="sn">
<value>efternavn</value>
</property>
<property name="description">
<value>some desc</value>
</property>
<property name="telephoneNumber">
<value>789</value>
</property>
<property name="givenName">
<value>fornavn</value>
</property>
</object>
How do I parse that string and get the value for an element like "telephoneNumber"?
Thanks in advance
- Anders
My new photo website[^]
|
|
|
|
|
You can do that First Convert that String into Stream then put that Stream as parameter to XmlTextReader constructor and read that
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
First thing first, load it into a XMLDocument
XmlDocument xmlDoc = new XmlDocument();<br />
xmlDoc.LoadXml(yourStringOfXmlData);
Then, use XPath to find the right node
XmlNode node = xmlDoc.DocumentElement.SelectSingleNode("property[@name='telephoneNumber']/value");<br />
if(node != null)<br />
Console.WriteLine(node.Value);<br />
code typed without testing.
|
|
|
|
|
Thanks, got it to work perfectly
|
|
|
|
|
hello.....
I had crated one array dynamically from database.....
nwo i want to know the dimesion of each column....
i.e.
Here I am Providing already created 2-dim array
string[,] colArray = new string[,] { { "StatusID", "System.Int32", "ABC" }, { "StatusMsg", "System.String", "ABC" }, { "Size", "System.Double", "ABC" } };
colArray[i,j]
what i want to know value of i and j........
|
|
|
|
|
Well, colArray.Length gets you the length of the 1st dimension, and colArray[0].Length gets the 2nd dimension. This (of course) assumes that you haven't created jagged arrays.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hey guys,
Any idea how to auto number a specific column when a new row is created in datagrid contol???
Thanks
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
If it is bound to a DataSet then set the AutoIncrement property of this DataSet to true.
Otherwise you have to do it on your own (in your source of data).
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
Thanks
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
is anybody having cafe serverproject in asp.net 2.0 using C#?
do reply.......
|
|
|
|