|
hey whats up? i need help! i query a database off a web site and i onnly want a few fields, this is in c#..
this db has thousands of records which is why i need to code this. this is just to make a contact list.
what i want is:
Pastor/Leader: John Cowan
Contact Info: phone: 916-387-9750
Mailing Address: 7322 Folsom Blvd, Sacramento, CA 95826 USA
Website: http://www.calvarysac.org/
html is:
body {margin ; font-family:"lucida grande", tahoma, arial, verdana, sans-serif; font-size:10px}
label {display: block; font: normal 10px/16px "lucida grande", tahoma, arial, verdana, sans-serif; margin: 0; padding: 0px 0; color: #666;}
.textfield {font: normal 11px/13px "lucida grande", tahoma, arial, verdana, sans-serif; padding:2px; margin: 0; border: 1px solid #ccc; background-color: #eee; width: 100%; color: #666;}
.textfield2 {font: normal 11px/13px "lucida grande", tahoma, arial, verdana, sans-serif; padding:2px; margin: 0; border: 1px solid #ccc; background-color: #eee; width: 207px; color: #666;}
#contact td {padding:5px;}
#contact table {width: 100%;}
h1 {margin ; padding ; font-size:20px; margin-bottom:7px}
div.hr {height: 2px; background: #ddd; margin:10px 0 7px 0 }
div.hr hr {display: none;}
a {color:#374872}
a:visited {color:#374872}
a:hover {background:#ddd}
#verified p span {padding:3px}
/* Images */
img {border: none;}
p.img {margin: 0; padding: 0;}
p.img img {float: right; margin: 0 0 1em 1em;}
p.img a img {padding: 3px; border: 1px solid #c4c4c2;}
p.img a:hover img {border: 1px solid #949492;}
Calvary Chapel Sacramento
Pastor/Leader: John Cowan
Contact Info:
phone: 916-387-9750
facsimile: 916-387-9752
Mailing Address:
7322 Folsom Blvd.
Sacramento, CA 95826 USA
Meeting Address:
7322 Folsom Blvd.
Sacramento, CA 95826 USA
★ View Map
Website: http://www.calvarysac.org/
//<![CDATA[
if(typeof sIFR == "function"){
sIFR.replaceElement(named({sSelector:"h1", sFlashSrc:"/assets/swf/avenir.swf", sColor:"#374872", sLinkColor:"#000000", sBgColor:"#FFFFFF", sHoverColor:"#CCCCCC", nPaddingTop , nPaddingBottom , sFlashVars:"textalign=left&offsetTop=0"}));
};
//]]>
|
|
|
|
|
Hello. Is it possible to create controls from a textfile?
For example, my text file contains:
Panel pNew = new Panel();
pNew.BackColor = System.Drawing.SystemColors.ControlLightLight;
pNew.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
pNew.Location = new System.Drawing.Point(3, 5);
pNew.Name = "panel1";
pNew.Size = new System.Drawing.Size(368, 408);
pNew.AutoScroll = true;
How do I go about it?
|
|
|
|
|
Hello
Well, to some extent Yes! It's possible, but depends on:
1- What are you storing in your text file? Are you storing other parameters like the location, size, etc...??
2- Do you know exactly what you are storing in the text file? ie. All the controls hve the same format, or do some controls have more properties stored than others?
3- Are all controls of the same type, or different types?? Do you know all the types you are declaring? Will there be UserControls, or controls unknown at design time involved?
Regards
|
|
|
|
|
The text file contains all the controls and it is of different types.. Some controls have more proerties stored and, yes I'm storing the location too..
Is there a command that executes this (the creation of controls?)?
Thank you!!
|
|
|
|
|
Well, one easy clumsy way -if you know all the types of controls you will declare- is to parse the text file and Create the controls in a switch. eg.
switch (MyInputType)
{
case "TextBox":
{
TextBox temp = new TextBox();
MyForm.Controls.Add(temp);
}
}
This way the temp variable will be destroyed, but the reference in the MyForms.Controls will keep the control alive. This way you can declare as many TextBoxes as you want.
If you expect UserControls or controls that you don't know its type, you'd have to use Reflection namespace which is by far bigger than to be covered in a single post.
PS.
Why use TextFile?? Why not XmlDocument?
Regards
|
|
|
|
|
I just started using C# in VS2003 (after learning vb.net)
When I type a variable name in VS2003 for a vb.net project - it corrects any capitalization for me.
Is there a way to do that for C# projects in VS2003 ?
Thanks.
|
|
|
|
|
Unlike VB, in C# variable names are case sensitive, so no. Otherwise how could you define a myVariable and a MyVariable? (not saying that that is a good idea mind).
|
|
|
|
|
Well thats my point - I dont want to so why not help me out a little on the capitalization ?
|
|
|
|
|
As it's case-sensitive it can't help you out in the way you want. However, in VS 2005 the IntelliSense is a bit more intelligent in the following way.
Suppose you write
int customer = 5;
Then you start typing CUs
Then IntelliSense will pop up and automatically select the customer declaration. If you tab then it will substitute customer for CUs.
But if you were to fully type CUstomer then it won't auto-correct it afterwards. In theory, though it could make an inference based on the fact that the only "CUstomer" that's been declared in scope is "customer."
Anyway, if you're in a position to try using C# 2005. It's a much nicer editing experience. As it happens, at work I'm using neither C# 2003 nor 2005 but VB 2003.
C# 2005's IntelliSense and code snippet behaviour is better than VB 2005's BTW.
Kevin
|
|
|
|
|
The development of an application that handles encryption (AES) of data stored in a database (SQL server 2005) at the application level through C#. So in practice I would in C# do some simple data handling and then encrypt these data and then insert these data in the corresponding DB tables. This is what I am trying to develop, but I am just in a researching face for the moment, hence my question.
Can anybody reply me on the how difficult this should be to accomplish and where to concentrate my researching and if any body as any form of input to this I am very pleased to receive this too.
Thank you
Kenn Kikkenborg
|
|
|
|
|
i use a class writen by Peter Huber, for pop3 client but i have a problem with it
I cannot establish a connection throw a proxy but when i use direct connection "not firewalled or proxy environment" its work good , are there any changes must done on this method ( connect() )???? or any help please:
public void Connect() {
if (pop3ConnectionState!=Pop3ConnectionStateEnum.Disconnected &&
pop3ConnectionState!=Pop3ConnectionStateEnum.Closed &&
!isTimeoutReconnect) {
CallWarning("connect", "", "Connect command received, but connection state is: " + pop3ConnectionState.ToString());
} else {
//establish TCP connection
try {
CallTrace(" Connect at port {0}", port);
serverTcpConnection = new TcpClient(popServer, port);
} catch (Exception ex) {
throw new Pop3Exception("Connection to server "+ popServer + ", port " + port + " failed.\nRuntime Error: "+ex.ToString());
}
if (useSSL) {
//get SSL stream
try {
CallTrace(" Get SSL connection");
pop3Stream = new SslStream(serverTcpConnection.GetStream(), false);
pop3Stream.ReadTimeout = readTimeout;
} catch (Exception ex) {
throw new Pop3Exception("Server " + popServer + " found, but cannot get SSL data stream.\nRuntime Error: "+ex.ToString());
}
//perform SSL authentication
try {
CallTrace(" Get SSL authentication");
((SslStream)pop3Stream).AuthenticateAsClient(popServer);
} catch (Exception ex) {
throw new Pop3Exception("Server " + popServer + " found, but problem with SSL Authentication.\nRuntime Error: " + ex.ToString());
}
} else {
//create a stream to POP3 server without using SSL
try {
CallTrace(" Get connection without SSL");
pop3Stream = serverTcpConnection.GetStream();
pop3Stream.ReadTimeout = readTimeout;
} catch (Exception ex) {
throw new Pop3Exception("Server " + popServer + " found, but cannot get data stream (without SSL).\nRuntime Error: "+ex.ToString());
}
}
//get stream for reading from pop server
//POP3 allows only US-ASCII. The message will be translated in the proper encoding in a later step
try {
pop3StreamReader= new StreamReader(pop3Stream, Encoding.ASCII);
} catch (Exception ex) {
if (useSSL) {
throw new Pop3Exception("Server " + popServer + " found, but cannot read from SSL stream.\nRuntime Error: " + ex.ToString());
} else {
throw new Pop3Exception("Server " + popServer + " found, but cannot read from stream (without SSL).\nRuntime Error: " + ex.ToString());
}
}
//ready for authorisation
string response;
if (!readSingleLine(out response)) {
throw new Pop3Exception("Server " + popServer + " not ready to start AUTHORIZATION.\nMessage: " + response);
}
setPop3ConnectionState(Pop3ConnectionStateEnum.Authorization);
//send user name
if (!executeCommand("USER "+ username, out response)) {
throw new Pop3Exception("Server " + popServer + " doesn't accept username '" + username + "'.\nMessage: " + response);
}
//send password
if (!executeCommand("PASS " + password, out response)) {
throw new Pop3Exception("Server " + popServer + " doesn't accept password '" + password + "' for user '" + username + "'.\nMessage: " + response);
}
setPop3ConnectionState(Pop3ConnectionStateEnum.Connected);
}
}
|
|
|
|
|
I want to display doc(MS Word) file. I have used rich text box control but it is not working. I want to show graphics (circles....) in my appliction. Is rich txt box is right choice or.... . Tell me about it. Please give me code example if possible.
Thanks
Syed Shahid Hussain
|
|
|
|
|
Hello Shahid.
You can't display Word Documents on your forms using RichTextBox, because it won't understand the formtting of the document.
First of all, check this article[^].
If it's not what you want, you'd have to use somthing called Word Interop -shorthand for Inter operability-
The namespace is Microsoft.Office.Interop.Word , but first you have to reference to it:
In the solution explorer =>Right click on your project's name => Add reference => COM tab => Microsoft Word object library
Important note:
This will require that MS Word is installed on your machine and the user's machine
and the office programming section[^] in the articles may be useful.
Best Regards
|
|
|
|
|
Very Thanks Brother.
God Bless You
Syed Shahid Hussain
|
|
|
|
|
HI,
I learned how to make events using delegates. And, to my understanding, all the events must be made using the control's existing prime events. i.e, If I want to trigger an event for a textbox whenever an user type 'A', i will have to use text_Changed event and check if the text == 'A'. But my question is, How can I create a prime event for a control. Is it the only way to use Timer with a very small timespan and check if the control's property changed and trigger event ?
I have an user control (HTML Editor Control) which doesn't have documentHTML_Changed event. I want to create this event and I did not find any supporting prime eevent to know when exactly the documentHTML property has been changed for that HTML editor. Thats why I was thinking what is the solution for creating this kind of event other than using TIMERs ? To me, TIMERs are the worst solution as they are always running and eating CPU resources for nothing.
Regards,
Emran
|
|
|
|
|
bashiwala wrote: I have an user control
If you create a user control you can add whatever events you want and raise them whenever you want. What's the problem?
|
|
|
|
|
Hello, Thanks for reply.
Say for example, web browser control has a property named DocumentText but it doesnot have any event DocumentText_Changed. Now, is there any way to know when the DocumentText has been changed other than using Timer and check every milli second if the DocumentText is not equal to the last value ..etc.. . If I have some supporting events, then I can make custom event based on the supporting event, right ? But I was wondering how to make the core event like TextChanged, EnableChanged, etc for a control which doesn't have these events defined !
Thanks again
Emran
|
|
|
|
|
Hello Emran
Sure there is a way of making your own events. In your custom class declare your public event like this:
public event HtmlDocumentChange OnHtmlDocumentChange;
HtmlDocumentChange is your handler's delegate.
Then you have to fire/raise the event by calling that delegate:
OnHtmlDocumentChange();
This is the very basic principle of events. The entire issue is when to know that the document has changed thus firing the event is specific to your contorl. If you are inheriting from WebBrowser control, you'd have to handle all events that might change the document -eg. Navigated, DocumentCompleted, DocumentTitleChanged, etc..-, then check the current document against the old one somehow. Depending on the changes you want to track you can store a backup copy of the current document in a private member to compare against, or just store the part you are tracking. When you sense a change in the document call the OnHtmlDocumentChange() delegate.
PS.
Using Timers is not bad.. It's disastrous way of firing event.
Regards
|
|
|
|
|
Is there a way to know where a browser is headed from a C# based application? i would like to be able to know what pages and files have been downloaded from a C# application, if there is a better way to do it using just the internet conection and not a browser that would be better. Please, help.
Victor Bello
you are what you research. VB
|
|
|
|
|
i've been trying some stuff, can anybody tell me how to use the SocketInformation.ProtocolInformation on C#? i can't get the socket to work.
VB
|
|
|
|
|
method #1: create a windows hooker to intercept the events of the browser
can be quite messy.
method #2: create a http sniffer (plenty of samples on this website)
|
|
|
|
|
Can you refer me to one, all ive found are programs or SDK you need to buy to create a sniffer, is there any other way to do it by myself?
Thanks, VB
|
|
|
|
|
Hello Everyone,
Does anyone know of a way to populate a TreeView with information from a table in a database and keep track of the unique identifier for that record? I can't really explain it well in words, but there are reasons why I cannot do a "SELECT WHERE XXX = 'e.Node.Text'" (off of the TreeView_AfterSelect. What I did at one point was actually store the file id's inside the treeview, enclosed in [ ]'s and did parsing to figure out which FILE_ID it was, and then I could pull up the information that way, but it looks ugly. e.g.
Parent
|
------- Child [1]
------- Child [2]
Where 1 and 2 are the unique key identifiers of that particular record in the database. I am just not sure how to go about linking a unique ID to every node in a TreeView without actually putting the ID right in the text for that particular node. I tried to populate an ArrayList with a structure that held the child's name and the ID for that child, and then iterate through the ArrayList when the treeview is clicked and find it ... but there can be duplicate entries in the database that have the same parent name and same child name.
So basically the question is, when working with a TreeView and populating it from a database where the only thing that you can be sure is unique is the ID unique key ... How to do track that key with each node to ensure that when you click on a node you are pulling the proper record out of the database?
Hopefully I made sense here. I rewrote this three times. I just can't really think of how to put this into words correctly.
|
|
|
|
|
Hi!
Each TreeViewNode has a property named Tag. This way you can assign an arbitrary object to each tree node.
Hope this helps.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Oh my! I read and read and read trying to find something like this. It is EXACTLY what I am looking for. I spent two days writing ArrayLists and all sorts of other stuff to try to keep track of the ID info!
Thanks a bunch for the response!!!!
|
|
|
|
|