|
Read my C# articles on image processing, but I think all you need to do is create a bitmap with your copyright message, and a magenta or limegreen background, draw it over your bitmap using a color key, then save them out. Quite a trivial exercise.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi all,
I want datagrid to be exported to excel (thru button). Following is my code but it is just displaying the header row. P.S.- I'm displaying some data on item databound.
Private Sub btnExcel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExcel.Click
RenderGridToExcelFormat(dgActivitySummary, "test")
End Sub
'''------------------------------------
Private Sub RenderGridToExcelFormat(ByVal grid As DataGrid, ByVal saveAsFile As String)
' check Excel rows limit
If grid.Items.Count.ToString + 1 < 65536 Then
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" & saveAsFile & ".xls")
' Remove the charset from the Content-Type header.
HttpContext.Current.Response.Charset = ""
'HttpContext.Current.Response.WriteFile("style.txt")
' Turn off the view state.
grid.EnableViewState = False
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
' Get the HTML for the control.
grid.HeaderStyle.ForeColor = Color.Black
grid.HeaderStyle.BackColor = Color.Red
grid.ItemStyle.ForeColor = Color.Black
grid.BorderColor = Color.White
ClearControls(grid)
grid.RenderControl(hw)
' Write the HTML back to the browser.
HttpContext.Current.Response.Write(tw.ToString())
' End the response.
HttpContext.Current.Response.End()
Else
HttpContext.Current.Response.Write("Too many rows - Export to Excel not possible")
End If
End Sub
'-----------------------
Sub ClearControls(ByVal control As Control)
Dim i As Integer
For i = control.Controls.Count - 1 To 0 Step -1
ClearControls(control.Controls(i))
Next i
If TypeOf control Is System.Web.UI.WebControls.Image Then
control.Parent.Controls.Remove(control)
End If
If (Not TypeOf control Is TableCell) Then
If Not (control.GetType().GetProperty("SelectedItem") Is Nothing) Then
Dim literal As New LiteralControl
control.Parent.Controls.Add(literal)
Try
literal.Text = CStr(control.GetType().GetProperty("SelectedItem").GetValue(control, Nothing))
Catch
End Try
control.Parent.Controls.Remove(control)
Else
If Not (control.GetType().GetProperty("Text") Is Nothing) Then
Dim literal As New LiteralControl
control.Parent.Controls.Add(literal)
literal.Text = CStr(control.GetType().GetProperty("Text").GetValue(control, Nothing))
control.Parent.Controls.Remove(control)
End If
End If
End If
Return
End Sub 'ClearControls
Please Help...
Thanks,
Hetal Kamdar
|
|
|
|
|
i use the bulk insert statement and my query are like this
BULK INSERT tmpStList FROM 'C:\test1.txt' WITH (FIELDTERMINATOR = ',')
It keep giving me the error message
Server: Msg 4860, Level 16, State 1, Line 1
Could not bulk insert. File 'C:\test1.txt' does not exist.
Anyone know how to solve this? Thank you
|
|
|
|
|
Have you tried copying the .TXT file to the SQL server first, then running this statement?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am kinda lost, can you show me how?
|
|
|
|
|
I am kindda lost, how do you copy .TXT to SQL server, somehow they gave this error
Server: Msg 4861, Level 16, State 1, Line 1
Could not bulk insert because file 'y:\pricefile\test1.txt' could not be opened. Operating system error code 3(The system cannot find the path specified.).
|
|
|
|
|
OK, suppose your SQL Server is installed on one machine. It recognizes the C: drive only on the machine it is residing on. It will not recognize the C: drive on a client machine. So trying to load a file with a path "C:\test1.txt" when the file is on the client will not work, because the SQL Server looks on it's own C: drive for the file and the file does not exist. If you need to run the action from a client, the SQL Server needs to recognize a mapped drive on the client. If you copy the file to the SQL Server machine, use C:\Test1.txt. If your file is on your local machine as C:\Test1.txt, AND your local C: drive is mapped to the SQL Server machine so it recognizes your local C: drive as "Y" then use Y:\Test1.txt.
Hope that makes sense?
Robert
|
|
|
|
|
you're right, thanks rwestgraham. I got it working now.
|
|
|
|
|
I'm making a program in VB.NET to manage concerts, but the problem is that each concert would have it's own database fields since each concert has different kinds of expenses and whatnot. So I thought in order to do this, I could figure out how to create new tables using the language, but I can't seem to figure it out. I've looked through my teacher's manuals and can't seem to find the code for it. I'm using an OLE database made in Microsoft Access.
I found something called datasetname.tables.add but I don't really know how to use it. If someone could help me, I would appreciate it.
|
|
|
|
|
How much do you know about databases? Databases don't have fields and you should not create a table for each concert.
Instead of looking VB manuals, maybe you need to look at some books that explain relational databases, how information is stored in tables, and how the tables are related to each other. If the database is created correctly, you should not have to keep adding tables to it.
|
|
|
|
|
I need to publish the reports which are in VB online,using ASP.ie. to open up the reporst in the Internet explorer browser.Pls send me the solution...as i need to implement immediately...
|
|
|
|
|
That's about a vague a question are you can get. What reports? Generated by what? Crystal Reports? Excel? Access?
Without further information, there's nothing we can do to help you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I got the Management Information System(MIS) in VB.Now my requirement is to publish this MIS report that can be of any sort,in Internet explorer using ASP.So that people can view the report online.
|
|
|
|
|
kebi wrote:
Management Information System
This could be a million different products by any number of manufacturers. You're going to have to get with the manufacturer of your software to see what interface there is for generating the reports you want.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I am trying to make a font bold at runtime but I can not work it out.
I am currently changing the color of the font using:
lblPageStatus.ForeColor = System.Drawing.Color.Red
How can I do the same to make it bold?
Thanks
Shawn
|
|
|
|
|
u have to need creating a new font, then use that. Dont forget The Bold property of any Font is ReadOnly
Dim newFont as new Font (previousFont.Name, FontStyle.Bold )<br />
lblPageStatus.Font=newFont
|
|
|
|
|
Thanks for the reply. I will give that a go. It does seem a little odd that you have to create a new font to change the bold property, when you can just set a color without having to create a new font. Oh well. Thanks again!
Shawn
|
|
|
|
|
It's not odd if you understand the difference between selecting a font and drawing one. When you change the type to Bold, you're actually changing the shape of the Font. If the Font includes a bold version, then you're actually selecting a new font just by changing the style. For instance, a font can include a normal version of the character outlines, italics version, bold version, italics and bold version, underline, ... Now, if you selected a bold version of a font and the font file don't have a bold version, it can be calculated, or approximated. In either case, a new set of outline coordinates are used to draw the font. This is why properties like Bold are ReadOnly. Now, changing the color doesn't change the coordinates of the outlines that are drawn, so you can change the color all you want without regenerating the coordinates again.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello there
I want to place the background image on tree view and list view.
Can any one help me out ?
Best Regards
Rizwan Bashir
|
|
|
|
|
Again, not support through properties. You'll have to ownerdraw the controls to get this functionality. Search for "custom drawn treeview" or "ownerdraw treeview". You'll find a bunch of examples, even a few here on CodeProject.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello there
I want to change the color of Toolbar , Status bar, Menu (fore color and back Color) any one knows how ?????
Best Regards
Rizwan Bashir
|
|
|
|
|
Toolbar - check into the BackColor and ForeColor properties. If the functionality you want isn't supported by these properties, you'll have to ownerdraw the ToolBar. Google for "ownerdraw toolbar" for examples.
StatusBar - same thing - check into the BackColor and ForeColor properties. Now, if you want to change the color of the StatusBarPanels, you'll have to ownerdraw those. Again, Google for "ownerdraw StatusBarPanel".
Menu - Changing the color through properties is not supported. Again, search for "ownerdraw menu". There's even a bunch of example here on CodeProject. Just search the Articles.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello
Can i get keyboard toggle state from .net like GetKeyBoardState() API in Class.If any body have directInput.dll file send to me
My Id: rugfy@yahoo.com
Ishak
|
|
|
|
|
Hi
I'm in the process of rewriting a access database type of application, but I run into a problem.
This is the Access VB code.
dn = FreeFile
Open matrix For Binary Access Read As #dn
Get #dn, dsn, km
Close #dn
This the VB.Net code
FileNumber = FreeFile()
FileOpen(FileNumber, filepath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared)
FileGet(FileNumber, FindValue)
To start, I don't none the structure of the file. I'm sending in a search value
which should return a result. The VB.Net function isn't returning the same value as the Access VB function.
Any ideas why its happening would be appreciated!.
Thanks
Regardt
Africa is a tough country
--"Hello daar vir die Afrikaans sprekende"--
|
|
|
|
|
What is returned all depends on the data type of the variable you are reading this data into. If you define FindValue as an Integer, VB.NET will read the first 4 bytes of the file into FileValue. If your defined FindValue at a UInt64, the first 8 bytes will get read. The same is true for the VB code in Access. What is "dsn" and "km" defined as? What is FindValue defined as?
BTW: An Integer in VBA and and Integer in VB.NET don't have the same definition. A VBA Integer is 16-bits (2 bytes), while in VB.NET is 32-bits (4 bytes).
Also, in the Access code, you're reading two values, where as in the VB.NET code your reading one. Any reason why?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|