|
It's because both \r and \n are converted in the richtextbox to a linebreak.
You only need to use either \n or \r. If you use both, as in CRLF, it will convert them into two linebreaks.
|
|
|
|
|
Okay, but if you look at my ex so can you see that a line break acures in the midle of a word with out any /r och /n, how cand this be?
The richtext box is big enouth so it have nothing to do with wraping i think.
Best Regards
Jimmy
|
|
|
|
|
Have trayed to place the string in a file instead but its the same problem.
Pleas help!
BestRegards
SnowJim
|
|
|
|
|
it is fixed, thanks anyway.
Apperently i was using writeline when i was writing to my stream, and this writeline is adding \n on the end of the data.
Best Regards
SnowJim
|
|
|
|
|
|
trying to match a pattern for an application that I working on for my self and can't seem to grasp this pattern in the regex fashion
so the pattern I am trying to match
kbfi ksea sea bfi
([a-zA-Z0-9]{4})|([a-zA-Z0-9]{3}) sorta works but it doesn't work if I put in the (\s) to catch the space so it splits incorrectly. Pattern should match something with 3-4 letters like above anything more than 3-4 letters without a space should be ignored so no garbage like this
asdfkjasdf aodf
Also it should be able to match a single set without spaces
kbfi
should be detected as well. As for correctness of the actual data in the string it will be verified against data stored in db tables
Thx
Morgan
|
|
|
|
|
|
I am trying to convert over a Crystal Reports report from using a database to using a dataset. That part seems to have gone along just fine. I followed the instruction Microsoft gives for doing that and also for creating an XSD dataset (which is how I was able to convert the report). I'm sure to most of you, the solution to my problem is simple.
Here's my problem: I don't know how to get data into that dataset. I can't use the standard method of creating an OdbcDAtaAdapter and doing a Fill into the DataSet. I've tried, it doesn't work. I keep getting the following error if I try:
Fill: SelectCommand.Connection property has not been initialized.
Here's the command that generates the error:
daDalyORHED.Fill(dsDalyData1, "orhed");
Here are the relevent parts of the code:
daDalyORHED = new OdbcDataAdapter("SELECT * FROM PUB.orhed orhed WHERE OrdNum = '" + strOrdNum + "'", connDaly);
connDaly = new OdbcConnection("DRIVER=MERANT 3.60 32-BIT Progress SQL92 v9.1D;UID=userid;HOST=siifpa001;PORT=apluslvsv;DB=apluslv;PWD=password");
dsDalyData dsDalyData1 = new dsDalyData();
Obviously, dsDalyData is the name of my XSD dataset.
Can anybody please help me get my DataSet populated? It's kinda useless without that.
--In a world without fences, who needs Gates?
|
|
|
|
|
It not the typed dataset's fault... something is wrong with your connection.
Try to put connDaly = new... before the first line you posted (... new OdbcDataAdapter).
It should work.
|
|
|
|
|
first drag n drop sqldataadpter component on ur form
then one wizard will be shown
click on the next option then it will ask for the server name
give . for local host
if u r using sql server authentication select that radio button
else
select windows authentication
if u select sql server then give user name and password
u acan leave password blank by checking allow blank password
after that u give the database name u want to use
and click on test connection
if it give one message window with "TEST SUCCEED" then click
ok
and
next
there it will show u one query6 builder button click on it
it will give u a list of ur tables in the database
select tables from the list and add
after rhat click next
and then click on finish
it will automatically create a sql connection for u
then right click on sqldataadapter pasted on ur form
one menu will be shown to u
choose generate dataset
use typed dataset
and click ok
after that drag n drop one datagrid on ur form
write the following code in the page load event
sqlDdataAadapter.Fill(dataset name);
DataGrid1.Databind();
set properties OF
DATA GRID
DATASOURCE NAME
DATATEXT FIELD
TRY IT IT WILL SURELY WORK
BEST OF LUCK
TripathiH
|
|
|
|
|
hi,
i have a problem regarding this piece of code it throw an exception ("time out expired ") can anyone tell me why
<br />
try<br />
{<br />
Stream reqStream = webRequest.GetRequestStream();<br />
reqStream.Write(requestBytes,0,requestBytes.Length);<br />
reqStream.Close();<br />
HttpWebResponse webResponse=(HttpWebResponse)webRequest.GetResponse();<br />
if (webRequest.HaveResponse)<br />
{<br />
foreach(Cookie retCookie in webResponse.Cookies)<br />
{<br />
bool cookieFound = false;<br />
<br />
foreach(Cookie oldCookie in ccContainer.GetCookies(destination))<br />
{<br />
if (retCookie.Name.Equals(oldCookie.Name))<br />
{<br />
oldCookie.Value = retCookie.Value;<br />
cookieFound = true;<br />
}<br />
}<br />
if (!cookieFound)<br />
ccContainer.Add(retCookie);<br />
<br />
} <br />
if ((webResponse.StatusCode == HttpStatusCode.Found) || <br />
(webResponse.StatusCode == HttpStatusCode.Redirect) ||<br />
(webResponse.StatusCode == HttpStatusCode.Moved) ||<br />
(webResponse.StatusCode == HttpStatusCode.MovedPermanently))<br />
{ <br />
WebHeaderCollection headers = webResponse.Headers;<br />
return SendRequestTo(requestBytes,new Uri(headers["location"]),credential); <br />
}<br />
StreamReader stream = new StreamReader(webResponse.GetResponseStream());<br />
string responseString = stream.ReadToEnd();<br />
stream.Close();<br />
return responseString;<br />
}<br />
throw new ApplicationException("No response received from host.");<br />
}<br />
catch(WebException e)<br />
{<br />
Trace.WriteLine("Exception occured " + e.Message);<br />
throw new ApplicationException("Exception occured while sending request.",e);<br />
}
|
|
|
|
|
If "time out expired" is the exception text, then that is the reason your code has a problem. Try changing "e.Message" to "e.ToString()" so you know which line had the problem (you might get a little bit more information, too).
Some of the basic reasons for a timeout are that the server isn't up, you have a bad address, or your connection to the server has been interrupted somewhere along the way.
John
"You said a whole sentence with no words in it, and I understood you!" -- my wife as she cries about slowly becoming a geek.
|
|
|
|
|
Hey!
If i create a byte[] like this
<br />
byte[] tmpData = new byte[1024];<br />
tmpData will have 1024 elements, all set to "0"
The data i will add to this byte array could be 0 how do i now what place i shold write on next time?
ex
first write
element 0 1 2 3 4 5 6 7 8 9 10 11 12 13
data 24 0 5 21 6 4 14 2 9 18 0 5 4 0
if i then whant to add more data to this byte[], how do i know that element 14 is the next place to add data if a regular element in the byte[] is 0?
Maby i could set all elements to -1 on creation, and then test against this, but this will be alot of test(preformance).
I could also store a extra int that keeps track of where to write the next turn, but this will be som extra class and vaibels.
Is there another way to do this?
Best Regards
SnowJim
|
|
|
|
|
The best way to do it is to track the index number that you last wrote to. If you have to try and find the last element, which you've already said you really can't do anyway, that's just overhead your adding searching through the array. It doesn't look like you have much of a choice here...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks!
i Think i will do this another way, all the oporations i will have to do with this byte array will probely take more preformance.
BestRegards
SnowJim
|
|
|
|
|
how can i start an application i.e process and then stop it when desireds...is there a to start and stop applications
|
|
|
|
|
See the documentation on the Process class, here[^] on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
To start a process (e.g. Notepad) you could say something like:
using System.Diagnostics;<br />
.<br />
.<br />
.<br />
<br />
Process myProcess = new Process();<br />
myProcess.StartInfo.FileName = "Notepad";<br />
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;<br />
myProcess.Start();
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
hi guys,
can anyone tell me how i candetect a net connection and then lauch an application. It would also be great if someone could tell me how i can stop the application when the net connection is disconnected.
Plz guys, no lame stuff like using timers!
|
|
|
|
|
What do you mean by "detecting a net connection"? Are you talking about a connection request coming in from the outside or an outbound connection request? Are you talking about ANY type of connection, like NetWare, NetBIOS, TCP, UDP, ..., or are you just looking at IP traffic only?
There's nothing that will detect all connection traffic and notify you. In order to get something like this to work, you'd probably have to implement a type of firewall to do something like this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
no...what i meant was like ICQ. When ICQ detects an internet connection, it launches the messenger automatically. I want to make something similar. How can i detect an internet connection
|
|
|
|
|
there are two ways to implement that, the easy way, and the hard way which is i dont know how to do it but i know that u can do it,
ok the easy way is to use i timer that raises an event every 1 seconds for example,
when it fires the event, ping any website do u want, lets say www.codeproject.com, if u got an aknowledgement, then the internet connection is established otherwise, there is no connection
now the HARD way, there is a win32 dll which raises an event whenever the connection is established, u have to import that DLL and hook ur function with it.
actually, it is easier than doing the first way, but if u didnt find the name of that DLL to import it or if u dont have a background about programming win32 API then u have to use the first way
|
|
|
|
|
Have a look here[^]
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
this is it man, the boolean function returns true or false, now all u have to do is to call this function every period of time using a timer, if it returns true, //do something, else //do something else
I'll send u the code by email or ill post it on codeproject.com
|
|
|
|
|
I sent the code to ur gmail account
|
|
|
|