|
if i work on Vb.net (not asp.net) , what will i do?
|
|
|
|
|
I subclassed a datagrid and use this code:
Dim x As Integer, y As Integer
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
Dim oExcel As Excel.Application
Static SheetCount As Integer = 1
Dim tbl As DataTable = CType(Me.DataSource, DataTable)
Cursor.Current = Cursors.WaitCursor
If Not Me.ReadOnly Then
Dim changedRows As New ArrayList
Dim row As DataRow
For Each row In tbl.Rows
If row.RowState <> DataRowState.Unchanged Then
changedRows.Add(row)
End If
Next
If changedRows.Count > 0 Then
Cursor.Current = Cursors.Default
MsgBox("There are pending data updates for this grid. Please save these updates to the database prior to exporting the data to Excel.", MsgBoxStyle.Information, "Pending Updates")
Exit Sub
End If
End If
If oExcel Is Nothing Then
oExcel = New Excel.Application
End If
wb = oExcel.Workbooks.Add
ws = wb.Sheets.Add
ws.Name = "Export" & SheetCount
SheetCount = SheetCount + 1
'write column headers
For x = 0 To tbl.Columns.Count - 1
ws.Range(Chr(65 + x) & "1").Value = tbl.Columns(x).ColumnName
ws.Range(Chr(65 + x) & "1").Font.Bold = True
Next
'write data
For x = 0 To tbl.Rows.Count - 1
For y = 0 To tbl.Columns.Count - 1
ws.Range(Chr(65 + y) & (x + 2).ToString).Value = tbl.Rows(x).Item(y)
Next
Next
oExcel.Application.Visible = True
' Release Application object and allow Excel to be closed by user:
If Not oExcel.UserControl Then oExcel.UserControl = True
System.Runtime.InteropServices.Marshal.ReleaseComObject(oExcel)
oExcel = Nothing
Cursor.Current = Cursors.Default
As you can see there are several references to "Me" in this routine for my use. In your case you would simply replace "Me" with the name of your datagrid. You will also need to add a reference to Excel in your project.
Hope this works for you.
Dean
|
|
|
|
|
Does anybody know others IDE for write and debug vb code? (for replace VB6)
Thanks in advance.
|
|
|
|
|
|
Can anyone help me, please!!!
I got problem regarding to my datareport. I need a long size paper (8.5" X 14") to print my data. How can I do that in "LANDSCAPE" format???
Thanks in advanced!!!;)
|
|
|
|
|
hello guys its me again i would like to ask anybody on how to toggle the check state in context menu sub item......how to disappear the check when i click and vice versa.....
hope anybody can help me......i admit im new in vb.net
have a nice day everyone
-- modified at 3:41 Thursday 30th March, 2006
|
|
|
|
|
If ContextMenuStripMenuItem1.Checked = True Then<br />
ContextMenuStripMenuItem1.Checked = False<br />
your code <br />
Else<br />
ContextMenuStripMenuItem1.Checked = True<br />
your code <br />
End If
Regards,
Chatura Dilan
If at first you don't succeed, try; try again, so that you know
what not to do the next time. The answer is out there.
|
|
|
|
|
hey Chatura thank you for sending me this code it helps me a lot....now im willing to learn more about VB.net coz i know theres people outher willing to share their knowledge. thanks a lot God Bless you....
before i forgot here's my YM (Yahoo Messenger) id i hope we could talk! thank you again!
and to all people outher thank you guys!!!!!!
|
|
|
|
|
You are welcome It’s nice to have an amiable friend like you.
Regards,
Chatura Dilan
If at first you don't succeed, try; try again, so that you know
what not to do the next time.
|
|
|
|
|
Your question was along the lines of:
My car does not work. Please tell me what is wrong
--------------------------------------------------------
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
hello..
my project is about when web cam detect motion, it will sent alert or messag to pda emulator.How it can sent alert or message to the pda emulator using vb,net 2005??
thanks
|
|
|
|
|
hello..
how can i access the folder that store video using pda simulator with vb.net 2005??
thanks
|
|
|
|
|
|
hi all...
i hav problems wif repeater function...d situation is...i hav a repeater where the user can input values which is in currency format (e.g. 20.00) by using the textbox..
d coding ( inside the repeater at <ItemTemplate> ) :
<td class="t_row" align="center">
<asp:TextBox id="txtRealAmt" runat="server"></asp:TextBox>
</td>
there's a calculate button which is also created inside the repeater itself
d coding :
<FooterTemplate>
<tr>
<th class="t_footer">
</th>
<th class="t_footer">
</th>
<th class="t_footer">
</th>
<th class="t_footer">
<asp:Button ID="btnCalc" CssClass="btn" Runat="server" CommandName="Calc" Text="Calculate"></asp:Button>
</th>
</tr>
</TABLE>
</FooterTemplate>
n d real problem is...how to calculate the total values which is entered by the user when the calculate button is click..the total values will be put at the textbox which is not in the repeater
hopefully u guyz can help me to solve dis prob..
tq
mada mada dane
|
|
|
|
|
txtspk is used for sms messaging due to the limited length of messages, and to make them quick and easy to type.
Technical forums have no such limitation, and mostpeople post using a keyboard rather than num-pad....so suffice it to say txtspk is not useful in describing a problem in clear terms.
|
|
|
|
|
I want to put a field from table in database to a combo box without a wizard. I want to using coding...can you help me ??? Please...
|
|
|
|
|
Request the table from the database, make it the datasource, and make the displaymember property the name of the correct column in the table.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
what section are you getting stuck on?
1) Create a Connection String that points to you database
2) Creating a Query String that selects the data that you want
3) Running the Query
4) Storing the retrieved values in a dataset or datatable
5) Setting the DataSource DisplayMember and ValueMember properties of the Combobox
Show what you have done for those 5 steps and if you still have a problem let us know
/jason
|
|
|
|
|
Hi all,
can someone help out on how to send email from my local host to the webmail using vb.Net???
Thanks in advance..
besah
|
|
|
|
|
well you can try this
imports system.net.mail
Private sub SendIT
Dim objMail as new MailMessage (strFrom, strTo, strSubject, strBody)
Dim objSend as new SMTPClient
objSend.Host="Your SMTP server"
objSend.Send(objMail)
End sub
As You can see, it is simple
Oggy
|
|
|
|
|
Sorry ...but i did not get it ...
"Localhost" .... if u want to use localhost then u shud configure smtp relay option in IIS.
Correct me if i am wrong ..
Thnx ...hope it helps.
Swammingo.
|
|
|
|
|
I am working on a program for VS.net that reads data from XML file and list them in treeview. The XML file named Dooa. Elements under Dooa are F1, F2, and F3. F1 is the root (parent) and F2 is the child and the content of F3 will be displayed in TEXTBOX1 if F1 or F2 selected. See the code.
What I want is that, if F1 are same for some roots then F2 (child(s)) for these roots should be listed under F1. Example
This is the XML
<dataroot NS0:noNamespaceSchemaLocation="Dooa.xsd" generated="2005-11-01T15:40:12" xmlns:NS0="Dooa">
<Dooa>
<F1>First</F1>
<F2>Car1</F2>
<F3>Home1</F3>
</Dooa>
<Dooa>
<F1>First</F1>
<F2>Car2</F2>
<F3>Home2</F3>
</Dooa>
<Dooa>
<F1>Second</F1>
<F2>CarA</F2>
<F3>HomeA</F3>
</Dooa>
<Dooa>
<F1>Second</F1>
<F2>CarB</F2>
<F3>HomeB</F3>
</Dooa>
</dataroot>
Then treeview should be like this
First
Car1
Car2
Second
CarA
CarB
What is the missing code that should take care of what I need as explained above??
Here is the code
Imports System.IO
Imports System.Xml
______________________________________________________________________
Public Class Form1
Inherits System.Windows.Forms.Form
Private Const dataXML As String = "c:\Data1.xml"
Private dsData As System.Data.DataSet
______________________________________________________________________
Private Sub loadData()
dsData = New DataSet("Data")
Dim fs As New FileStream(dataXML, FileMode.Open)
Dim xr As New XmlTextReader(fs)
dsData.ReadXml(xr)
End Sub
______________________________________________________________________
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
loadData()
Dim dr As DataRow
For Each dr In dsData.Tables("Dooa").Rows
TreeView1.Nodes.Add(dr("F1").ToString()).Nodes.Add(dr("F2").ToString())
Next
End Sub
_______________________________________________________________________
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect
Dim dr As DataRow
For Each dr In dsData.Tables("Dooa").Rows
If dr("F2").ToString() = TreeView1.SelectedNode.Text.ToString() Then
TextBox1.Text = dr("F3").ToString()
TextBox3.Text = dr("F2").ToString()
End If
Next
End Sub
_____________________________________________________________
Private Sub MenuItem2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
TreeView1.BackColor = Color.FromArgb(212, 199, 130)
TreeView1.Visible = True
End Sub
-- modified at 20:36 Wednesday 29th March, 2006
|
|
|
|
|
|
here's the brief story: it's about a transportation application
i create 2 projects(programs),admin(with database,journey,driver name,mileage setting,etc) and user interface page(user can book ticket)..admin can change(add/delete) info,etc and automatically the info is changing in other project(user interface)
ex:admin add new journey...and automatically there is a new journey added on user interface(station kiosk)
i know how to change things in other forms in one project..but how to do it if the project is separated?
or i have to add the user interface page to admin ?or what?haha...im getting worse
thank you
|
|
|
|
|
you're going to need a database that can be accessed by both applications:
admin creates new journey in database
station kiosks reads all journeys from database
this way, you can create 2 applications that share the same data
/jason
|
|
|
|