That's a good link, thank you!
J - Artificial intelligence is no match for natural stupidity
That's a good link, thank you!
J - Artificial intelligence is no match for natural stupidity
Thanks, I saw your post just after I posted my last one, I will check it out...
J - Artificial intelligence is no match for natural stupidity
After posting this I decided to play a little more, and I think I got it, hope this helps someone... I created a user control in the folder "Controls" called "WebUserControl.ascx". I decided if I could write the control programatically to the page, I could then use that variable later for the email section. Here is the code I came up with... if anyone can better it, please post here:
using System;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
System.Text.StringBuilder stringBuilder = new StringBuilder();
StringWriter stringWriter;
HtmlTextWriter htmlTextWriter;
stringWriter = new System.IO.StringWriter(stringBuilder);
htmlTextWriter = new HtmlTextWriter(stringWriter);
Control c1 = LoadControl("Controls/WebUserControl.ascx");
c1.DataBind();
c1.RenderControl(htmlTextWriter);
Response.Write (htmlTextWriter.InnerWriter.ToString());
}
}
J - Artificial intelligence is no match for natural stupidity
Good day fellow CodeProject.com'ers, I have an ASP.NET (C#) Base application which I would like to take the result of a custom user control, and use the resulting HTML from the control (or many multiple controls) as the body in an email. Any ideas?
J - Artificial intelligence is no match for natural stupidity
Thank you! Ah, a blonde moment of note! This one will definatly go down in the books a silly moment for me, hopefully this helps someone else :) Thanks again. - Artificial intelligence is no match for natural stupidity
Good day fellow codeproject.com'ers. I am missing a vital part of theory which I've identified when I tried the below. (I believe it's theory...) Please can one of you assist me by filling the theory gap I have. I've been through MSDN and Google, but to no avail... Question: Why can one not call a class from within another class? I don't mean within a function of a class, but at the top, where one declares variables pertaining to that class. E.g. Below:
Friend Class Class1
Dim _message As String
Public Property Message()
Get
Return \_message
End Get
Set(ByVal value)
\_message = value
End Set
End Property
End Class
And here is where it fails, intellisense doesn't see the properties or methods of the variable (first class), I've labled the variable as THISDOESNTWORK.
Friend Class Class2
Dim _myVariable As String
Dim THISDOESNTWORK as New Class1
Public Property myVariable()
Get
Return \_message
End Get
Set(ByVal value)
\_message = value
End Set
End Property
End Class
It works when I place the code Dim THISDOESNTWORK as New Class1
within a function, so either there is a "secret way to do this", or I'm missing a bit of .Net/OOB Theory. Thanks in advance... :)
Thanks, but it didn't work. Here is an example url I'm using: http://www.africam.com/cam.php?ID=tau[^]
Thanks, I will download it and check it out.
Silly me, I forgot to save the document. To do this, use workSheet.Save or workSheet.SaveAs(fileName).
Hope this helps, make sure you add your references. 'Open in Excel Dim myExcel As New Microsoft.Office.Interop.Excel.Application() Dim workBook As Microsoft.Office.Interop.Excel.Workbook Dim workSheet As New Worksheet Try If myExcel Is Nothing Then 'Failed to load Excell Object Else workBook = myExcel.Workbooks.Open("C:\myfile.xls", 0, True, 5, "", "", True, XlPlatform.xlWindows, "\t", False, False, 0, True, 1, 0) workSheet = workBook.ActiveSheet workSheet.Cells(1, 1) = "My value" workBook.Close() End If Catch ex As Exception 'Handle Exception End Try myExcel.Close()
Create a Database To create a database: CREATE DATABASE database_name
Create a Table To create a table in a database: CREATE TABLE table_name ( column_name1 data_type, column_name2 data_type, ....... )
Example This example demonstrates how you can create a table named "Person", with four columns. The column names will be "LastName", "FirstName", "Address", and "Age": CREATE TABLE Person ( LastName varchar, FirstName varchar, Address varchar, Age int )
This example demonstrates how you can specify a maximum length for some columns: CREATE TABLE Person ( LastName varchar(30), FirstName varchar, Address varchar, Age int(3) )
The data type specifies what type of data the column can hold. The table below contains the most common data types in SQL:
Data Type Description
integer(size)
int(size)
smallint(size)
tinyint(size) Hold integers only. The maximum number of digits are specified in parenthesis.
decimal(size,d)
numeric(size,d) Hold numbers with fractions. The maximum number of digits are specified in "size". The maximum number of digits to the right of the decimal is specified in "d".
char(size) Holds a fixed length string (can contain letters, numbers, and special characters). The fixed size is specified in parenthesis.
varchar(size) Holds a variable length string (can contain letters, numbers, and special characters). The maximum size is specified in parenthesis.
date(yyyymmdd) Holds a date
Create Index Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes, they are just used to speed up queries. Note: Updating a table containing indexes takes more time than updating a table without, this is because the indexes also need an update. So, it is a good idea to create indexes only on columns that are often used for a search. A Unique Index Creates a unique index on a table. A unique index means that two rows cannot have the same index value. CREATE UNIQUE INDEX index_name ON table_name (column_name) The "column_name" specifies the column you want indexed. A Simple Index Creates a simple index on a table. When the UNIQUE keyword is omitted, duplicate values are allowed. CREATE INDEX index_name ON table_name (column_name)
The "column_name
Error 3218 "Could not update; currently locked." This error occurs when a user tries to save a record that is locked by another user. To handle this error, program your solution to wait for a short period of time, and then try to save the record again. Or, you can display a message that explains the problem and give users the opportunity to try the operation again.
Try this... Dim FILE_NAME As String = "C:\test.txt" Dim tmpLine As String = "" If System.IO.File.Exists(FILE_NAME) = True Then Dim objReader As New System.IO.StreamReader(FILE_NAME) Do While objReader.Peek() <> -1 tmpLine = objReader.ReadLine() If Mid(tmpLine, 1, 1) = "1" Then ' Your code for command 1 ElseIf Mid(tmpLine, 1, 1) = "2" Then ' Your code for command 2 Else ' Your code for anything else End If Loop Else MsgBox("File Does Not Exist") End If
:doh: Does anyone out there know how to save an image directly from a webbrowser control once a page is loaded? I am not looking for a way to "re-download" the image based on the src value, because I can do that. I was thinking more along the lines of copying the image from the webbrower control into the clipboard and then saving it. The reason for this is, some sites only alow you to view thier pictures, when you are browsing thier site, so if you download the image directly, you get a different image.