|
Yes Colin, the canonical way works! thanks.
Ariadne
|
|
|
|
|
have you tried the WebClient class?
WebClient w = new WebClient();
w.DownloadFile(address_str,file_str);
//if you want to hold the file only in memory, try
// w.DownloadData() //for parameters check msdn
this is maybe a lot simpler than working with HttpWebRequest objects
best regards
j.
|
|
|
|
|
Yes much more easy! thanks.
I now use this WebClient version
Ariadne
|
|
|
|
|
how do i remove the beggining of a string up to a forward slash "/"?
|
|
|
|
|
string newstring = oldstring.Substring(oldstring.IndexOf('/')+1);
What this basically does:
- find the index of the first occurence of '/' and take the next char (+1)
- take a substring from the original string beginning at the index right after the index of the first backslash
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi.
I have a textbox and it has been setup to look like a textarea.
When I type in text, something like:
AAAAAAAAAAAAAA
AAAAAAAAAAAAAA
BBBBBBBBBBBBBB
BBBBBBBBBBBBBB
CCCCCCCCCCCCCC
CCCCCCCCCCCCCC
I have an insert button and I add it the database. When I display it on a page, then it all looks like:
AAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCC
How do I code it so that it displays the break tags on the aspx page? In classic ASP I did it as follows:
Replace(objRs("Description"), Chr(10), Chr(10) & " <br>")
I just need to know how to do this in C#, or if there is a better way to do it.
Regards,
ma se
|
|
|
|
|
Use string.Replace()[^]
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
How do I get the ASP Chr(10) the same as in C#?
Regards
|
|
|
|
|
|
Hi everybody, I'm new here and I'm a newbye with C#. This is my problem. I have to build a class that can dynamically create an XML file where tags are chosen by user through a graphical interface.
Data to store in the XML file are car engine data. There are a table format dataset and some single variables such as oil temperature ecc. Has someone a tip to help me in this work?
Thank you
|
|
|
|
|
As most of your variables are in a table, you can store the table in a DataSet, and add the few single variables in a one-record-table in the same DataSet. The method for converting the two tables to XML is already part of the framework:
DataSet.WriteXml[^]
_________________________________
Please inform me about my English mistakes, as I'm still trying to learn your language!
|
|
|
|
|
First of all, thanks for your reply. I know how to bind a DataSet with a table stored in an XML file, but I have other problems. I have to build table in xml in the way the user wants, interactively (is it the correct word? ).
Then I have to show the table data in a datagrid, but I've to make possible only to change values already present and making impossible to add row and columns. Is it possible?
Thank you again for your help and sorry for my bad english.
|
|
|
|
|
Why can't you the XMLDocument[^] class? You could add remove node or attributes just as you like.
_________________________________
Please inform me about my English mistakes, as I'm still trying to learn your language!
|
|
|
|
|
Hi,
I am quite new with C# and I do not know how to do this, so if somebody could help me a bit.
I have data in datagrid, which i have selected from db. At first, I want to insert it again to database, not update. ( I want to save the original data ). How can I insert it? updating is quite simple but I do not know how to insert it.( I can not figure out how to refer to datagrids cells in insert statement. )
The data is from one table only, but has foreing keys in it.
Can anyone help me?
|
|
|
|
|
can anyone help me with next problem:
one window("conditional parent") opens another("conditional child") with show method. forms are independent. then c_child opens another window("modal dialog") with showdialog() and wait for user input. the problem is that c_parent locks too, whereas i need in to be still working. i know that its possible to do, cause when i open messageBox or OpenFileDialog with showDialog only child is being locked. any ideas how to implement that?
I know one solution - m_dialog should be opened with show, and assign handle to c_child.Activate event, but its inconvenient, couse i need to put call of m_dialog.show and handling results in different methods.
|
|
|
|
|
Is the parent form also locked, if you call the ShowDialog method with c_child as the owner window?
modal_window.ShowDialog(this);
_________________________________
Please inform me about my English mistakes, as I'm still trying to learn your language!
|
|
|
|
|
yeap, thats the problem. i can provide test application if u dont belive (at another forum had to do that =))
|
|
|
|
|
Dear All,
I made a web setup project, in which I added a testboxes dialog. I made an installer library. Which I set in Custom action.
Please help me how i will set and read the text box dynamically?
With Regards
Manoj
|
|
|
|
|
What is the difference between Array and ArrayList ?
|
|
|
|
|
Basically, arrays are fixed size, and can only contain one kind of object (the object it was defined to contain). Addionally you need to know how many elements you have in your array in order to iterate through them.
ArrayLists, have a dynamic size. When you add a new element they will automatically increase their size. You can call the "Count" property to know how many elements are stored in the arraylist. When you extract an element from the arraylist, it wont have the original type, but instead is transformed into an object. You have to cast the object in order to turn it back into the Class it was originally.
Some more experienced guys may be able to correct me if I got somethign wrong.
Hope this helps,
azazel
|
|
|
|
|
Only 1 thing wrong that I spotted:
azazel00 wrote: Addionally you need to know how many elements you have in your array in order to iterate through them
Array has a .Length property.
|
|
|
|
|
hi all,
can someone please tell me why this code fails at the while loop to get remote data, commented // ?? error here ??
i cant understand why it is failing, when i debug it, it pauses for about 5 seconds at the m_gatewaySocket.Receive(receiveBytes) line and returns 0 at this line, there fore breaking loop condition.
it is making the conneciton keep-alive when i test as well, dont know if this helps diagnosis much, cause i get same problem if i comment out the check for keep-alive.
sorry for all the code, syntax highlighting would be good on this forum
btw this is running in its own thread that is spawned from TcpListener.AcceptSocket()
<br />
Debug.WriteLine(" ------------- start request ----------------- ");<br />
int bytes = ReadMessage(read, ref m_clientSocket, ref message);<br />
if (bytes < 1)<br />
{<br />
return;<br />
}<br />
HttpHeaderParser parser = new HttpHeaderParser(message);<br />
uriString = parser.RequestUri;<br />
host = parser.Host;<br />
<br />
Debug.WriteLine("Connecting to: " + host);<br />
Debug.WriteLine("Connection from: " + m_clientSocket.RemoteEndPoint);<br />
<br />
<br />
IPEndPoint gatewayEndPoint = new IPEndPoint(parser.AddressList[0] , 80);<br />
m_gatewaySocket = new Socket(m_clientSocket.AddressFamily, SocketType.Stream, ProtocolType.Tcp);<br />
<br />
if (parser.KeepAlive)<br />
{<br />
m_gatewaySocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, 1);<br />
} <br />
m_gatewaySocket.Connect(gatewayEndPoint);<br />
<br />
string output = "Connected to remote host: ";<br />
output += (m_gatewaySocket.Connected) ? "OK" : "ERROR";<br />
Debug.WriteLine(output);<br />
<br />
byte[] bytesToSend = m_ascii.GetBytes(message);<br />
m_gatewaySocket.Send(bytesToSend); <br />
<br />
byte[] receiveBytes = new byte[4096];<br />
int returnBytes = m_gatewaySocket.Receive(receiveBytes);<br />
<br />
Debug.WriteLine("Received " + returnBytes + " bytes from remote host");<br />
<br />
string returnPage = m_ascii.GetString(receiveBytes);<br />
<br />
while (returnBytes > 0)<br />
{ <br />
returnBytes = m_gatewaySocket.Receive(receiveBytes);<br />
returnPage += m_ascii.GetString(receiveBytes);<br />
}<br />
<br />
m_gatewaySocket.Shutdown(SocketShutdown.Both);<br />
m_gatewaySocket.Close();<br />
<br />
Debug.WriteLine(" ------------- end request ----------------- ");<br />
also if i test with site, www.google.com.au
the first call to int returnBytes = m_gatewaySocket.Receive(receiveBytes); that is before the while loop returns 1765 bytes as this
"HTTP/1.0 200 OK\r\nCache-Control: private\r\nContent-Type: text/html\r\nSet-Cookie: PREF=ID=56a9d4d131124690:TM=1131335053:LM=1131344693:IG=2:S=NKFaVbclxQhPNUPz; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com.au\r\nContent-Encoding: gzip\r\nServer: GWS/2.1\r\nContent-Length: 1363\r\nDate: Mon, 07 Nov 2005 06:24:53 GMT\r\nX-Cache: MISS from syd-nxg-pr3.tpgi.com.au\r\nProxy-Connection: keep-alive\r\n\r\n?
plus a whole lot more gibberish
kind regards,
g00fy
|
|
|
|
|
would this be better acheived with HttpWebRequest ? and similar classes
regs,
g00fy
|
|
|
|
|
Alright,
First, let me thank you for taking the time for reading my post.
Second, if I posted in the wrong place, I apologize. This is my first post.
Now on to my question:
If you are familiar with MySQL Administrator, you've seen the nice (at least, I like it) interface they use. It's a graphical menu on the left (ListView, perhaps), and something that looks to me like panels, on the right, that change when you press an item in the left menu. Sort of similar to outlook.
If you are not familiar with it, you can see exhibits A and B:
http://img481.imageshack.us/img481/3415/mysql19fq.png
http://img481.imageshack.us/img481/3504/mysql27zi.png
I’m relatively new to .NET, and Im not even a professional developer, so the question may seem obvious to some. But how would I go around achieving that kind of navigation system? I've thought of some ways, but the first one already failed, after banging my head against the keyboard for a while.
I attempted to use a "TabControl", and to make the top buttons not visible. Either it is not possible, or I just don’t know how.
My second option was to throw a lot of panels in the form, and make them visible/invisible when the "menu" items were pressed. After playing with it for a while, I found the fact that I couldn’t see the objects, behind the panel I could see, too disturbing. I gave up on the method.
I’m out of ideas. Any suggestions?
azazel
|
|
|
|
|
other than using alot of panels that gets messy, change your tab control to display buttons and cover them with a label or panel, no need to generate a member for it cause its just a cover up of the tab control buttons.
if you dont change to buttons you do not get a complete line across the top the active tab.
as for the left side it is fairly straight forward.
you might want to do some looking for 'explorer bar' or 'outllok sidebar' for some other ideas for the left side navigation
if anyone has a better idea for a multipage 'card type' layout please offer you 2cents worth cause this is the quickest way i know to do it
hope that helps
g00fy
|
|
|
|