|
Sorry, the example should have read :-
Enum DataTypes<br />
[Date]=1 '<--- Note the square brackets<br />
Text=2<br />
Number=3<br />
End Enum<br />
<br />
Property DataType As DataTypes<br />
Get<br />
'Your code here<br />
End Get<br />
Set(ByVal Value As DataTypes)<br />
'Your code here<br />
End Set
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
Thanks ,
Now i am able to show the Datatypes .
Now if i select the DataType "Date" then in Text property of Propertygrid , I want to show the datetimepicker .If not i want to show nothing .
For this i used ....
Public Class MyDate<br />
Inherits UITypeEditor<br />
Dim CustomDate As DateTimePicker<br />
Public Overrides Function EditValue(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal provider As System.IServiceProvider, ByVal value As Object) As Object<br />
CustomDate = New DateTimePicker<br />
CustomDate.Format = DateTimePickerFormat.Custom<br />
CustomDate.CustomFormat = "d-MMM-yyyy"<br />
CustomDate.ShowUpDown = True<br />
CustomDate.Show()<br />
Return MyBase.EditValue(context, provider, value)<br />
End Function<br />
Public Overrides Function GetEditStyle(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.Drawing.Design.UITypeEditorEditStyle<br />
Return UITypeEditorEditStyle.DropDown<br />
End Function<br />
it is showing the dropdown ,but not getting the Datetimepicker .
After selecting the date i want to show in Text Property .
For this what i have to follow ??????????
VB 8.0
|
|
|
|
|
Does any body know how to change to height of the textbox?
Do we have to use any API's to do that?
Any idea or link??
|
|
|
|
|
Hello,
There is no option to change the height of TextBox in .Net. But,
there are other options using which you can change the height.
1. You can set the 'MultiLine' property to True. However, this will
cause the text to wrap into multiple lines.
2. Another option is to increase the font of the Textbox. This will
automatically set the height of the Textbox.
I hope this answers your query.
Regards,
Allen
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
Hello every one
I am having a VB 2005 application and using “DrawString” to print a bill.
I want is to print the amount in floating point format, with decimal point like “56.00” instead of “56”
I am using floating points variables but when I am changing it into string, to sent it for printing “.00” will is lost
Also I wanted the numeric columns to be right aligned which I am not able to do
Can any one give me a idea how to do it..
Regards
Nishkarsh
|
|
|
|
|
Convert the value to a string format in the DrawString Method:
DrawString(Format(value,"0.00"),...)
This will ensure the format you want.
I don't speak Idiot - please talk slowly and clearly
|
|
|
|
|
Thanks for ur help. It is working.
Any idea how to align the text to right?
The numbers I am printing for amount should be right aligned.
In case of DrawString i can just tell the starting, i.e. only the left most point. How do I do that?
|
|
|
|
|
To align the text you have to set up a StringFormat object:
Dim sf As New StringFormat<br />
sf.Alignment = StringAlignment.Far<br />
sf.LineAlignment = StringAlignment.Center<br />
<br />
DrawString(Format(value,"0.00"),fnt, Brushes.Black,rectF,sf)
(I cant remember if the LineAlignment and Alignment properties are around the right way but a little trial and error will sort this out.)
Cheers
I don't speak Idiot - please talk slowly and clearly
|
|
|
|
|
To format a number as money use: YourDecimalOrFloatOrDoubleOrWhatEver.Tostring("F")
If you mean columns in a datagrid, you should explore the possibilities of the TableStyle.
My advice is free, and you may get what you paid for.
|
|
|
|
|
|
I am not very clear about what do u want to know, i will tel u what i got out of your question
1 U want to have a right click event.. If so then every object has a right click event handler associated you can go to the codes and select the object and then right click the event handler will come
2 U want to have a menu coming on right click of an object then use ContextMenuStrip
Hope this helps u
Good luck
|
|
|
|
|
You need to add an event handler for MosueDown to for your control, then test to see which mouse button is pressed. For example:-
Private Sub myControl_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles myControl.MouseDown<br />
If e.Button = Windows.Forms.MouseButtons.Right Then<br />
'Your code here<br />
End If
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
it is possible,,running Reporting services2005(rdl) from VB aplikasi Without IIS??
|
|
|
|
|
Colleagues,
Are there controls for VB6 that have the visual properties of a shape and line controls, and also have better mouse support, so that they can be made more interactive?
I’m writing an application that displays a process diagram. I’d like to add things like ToolTips and to make some elements on the diagram clickable.
I know that I can put a label on a shape and it would provide the mouse support that I need. It would work for square-ish shapes, but it doesn’t work well for circles.
- Nick
|
|
|
|
|
This is more of a VB thing because I am planning to execute it inside of the SQL 2000 DTS package but I am testing it in VB.Net app. It has been a while since I've worked with XML and I got stumbled with a simple one here!!
I just need to read Detail/DT and Detail/Accounts XML in the loop - I don't think my XPath is correct.
Somehow data that I read is not pasted into Excel document. What am I doing wrong. Please help.
Many Thanks!!!
<code>
<report xmlns="_x0031_000ImprAccount" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="_x0031_000ImprAccount " name="10Impr">
<table1>
<detail_collection>
<detail dt="2008-01-01T00:00:00" accounts="203" />
<detail dt="2008-01-02T00:00:00" accounts="219" />
<detail dt="2008-01-03T00:00:00" accounts="224" />
</detail_collection>
</table1>
</report>
</code>
xlapp = CreateObject("Excel.Application")
xlapp.Workbooks.Add()
xlapp.ScreenUpdating = False
DateMsg = "Generated on - " + FormatDateTime(Now(), 0)
' Load the xml file
strFileName = "C:\test.xml"
oDoc = CreateObject("MSXML2.DOMDocument")
oDoc.async = False
oDoc.validateOnParse = True
oDoc.Load(strFileName)
Detail = "Detail"
If oDoc.parseError.errorCode = 0 Then
R = 0
C = 0
xPath = "//Detail_Collection"
DetailCollection = oDoc.selectNodes(xPath)
Dim bookTitle, bookAuthor
For Each Detail In DetailCollection
DetailAccount = Detail.SelectSingleNode("Detail[@Accounts]").text ' Not sure if XPath is correct here..
xlapp.ActiveCell.Offset(R, C).Value = DetailAccount ' Copy to Excel
Next
End If
'Save Excel File
Dim filo
Dim Awkbk
Dim savefile
filo = "C:\testexcel.xls"
Awkbk = xlapp.ActiveWorkbook
savefile = Awkbk.SaveAs(filo, -4143, , , , , )
<code></code>
|
|
|
|
|
Although this may not be the answer you were looking for, let me tell you about the solution I use. I also needed to create excel reports on a regular basis, and I was on the edge of despair, because creating data directly into an Excel file just wouldn't work. I found three different methods suggested by Microsoft and many similar ones from coders all over the web, but could not get anything to work.
In the end someone here on the forum explained this method to me, that is slightly more clumsy to build at first, but will give you much more control over the output afterwards, is a lot less sensitive to (MS Excel) version problems, and can be easily adapted to work from any programming language:
First create an Excel file (in excel) that looks the way you want it to look. Next save this Excel file as xml. And last open this xml file with .NET Studio.
Finally (or alternatively) you can adapt the following function to your needs (the example is from one of my apps, so there is some stuff in there you may want to take out):
Public Function DatasetToExcel(ByVal ds As DataSet, ByVal ExcelPath As String)<br />
If File.Exists(ExcelPath) = True Then<br />
If MsgBox("Tiedosto on jo olemassa. Haluatko korvata sen?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then<br />
File.Delete(ExcelPath)<br />
Else<br />
ExcelPath = InputBox("Muuta nimi: ", "Tiedosto olemassa", ExcelPath)<br />
End If<br />
End If<br />
Dim doc As New StreamWriter(ExcelPath) 'use .xls even though its an xml file<br />
Try<br />
Dim startExcelXML As String = ""<br />
startExcelXML &= "<xml version="">"<br />
startExcelXML &= vbNewLine & "<workbook xmlns="" urn:schemas-microsoft-com:office:spreadsheet="" hold=" /"> startExcelXML &= vbNewLine & Microsoft.VisualBasic.Chr(10) & "" + " xmlns:o=""urn:schemas-microsoft-com:office:office"""<br />
startExcelXML &= vbNewLine & "xmlns:x=""urn:schemas- microsoft-com:office:" + "excel"""<br />
startExcelXML &= vbNewLine & "xmlns:ss=""urn:schemas-microsoft-com:" + "office:spreadsheet"">"<br />
<br />
'write the styles tags that format the data and cells properly<br />
startExcelXML &= vbNewLine & "<styles>"<br />
<br />
startExcelXML &= vbNewLine & " <style ss:id="" default="" ss:name="" normal="">"<br />
startExcelXML &= vbNewLine & " <alignment ss:vertical="" bottom="" />"<br />
startExcelXML &= vbNewLine & " <borders />"<br />
startExcelXML &= vbNewLine & " <font />"<br />
startExcelXML &= vbNewLine & " <interior />"<br />
startExcelXML &= vbNewLine & " <numberformat />"<br />
startExcelXML &= vbNewLine & " <protection />"<br />
startExcelXML &= vbNewLine & " </style>"<br />
<br />
startExcelXML &= vbNewLine & "<style ss:id="" colheader="">"<br />
startExcelXML &= vbNewLine & "<alignment ss:horizontal="" center="" ss:vertical="" bottom="" />"<br />
startExcelXML &= vbNewLine & "<font x:family="" swiss="" ss:size="" 8="" ss:bold="" 1="" />"<br />
startExcelXML &= vbNewLine & "<interior ss:color="" #c0c0c0="" ss:pattern="" solid="" />"<br />
startExcelXML &= vbNewLine & "</style>"<br />
<br />
startExcelXML &= vbNewLine & " <style ss:id="" reg="">"<br />
startExcelXML &= vbNewLine & " <font x:family="" swiss="" ss:bold="" 0="" />"<br />
startExcelXML &= vbNewLine & " </style>"<br />
<br />
startExcelXML &= vbNewLine & "</styles>"<br />
'write the header to the file<br />
doc.WriteLine(startExcelXML)<br />
'write one sheet per table<br />
For Each tab As Data.DataTable In ds.Tables<br />
Dim sheetname As String = "<worksheet ss:name="<br mode=" hold=" /"> sheetname &= Microsoft.VisualBasic.Chr(34)<br />
sheetname &= tab.TableName.Trim<br />
sheetname &= Microsoft.VisualBasic.Chr(34)<br />
sheetname &= ">"<br />
doc.WriteLine(sheetname)<br />
doc.WriteLine("<table>")<br />
'write the column headers<br />
doc.WriteLine("<row>")<br />
For Each col As DataColumn In tab.Columns<br />
doc.Write("<cell ss:styleid="" colheader=""><data ss:type="" string="">")<br />
doc.Write(col.ColumnName)<br />
doc.WriteLine("</data></cell>")<br />
Next<br />
doc.WriteLine("</row>")<br />
'write the table<br />
For Each row As DataRow In tab.Rows<br />
doc.WriteLine("<row>")<br />
'Dim i As Integer<br />
For i As Integer = 0 To tab.Columns.Count - 1<br />
doc.Write("<cell ss:styleid="" reg=""><data ss:type="" string="">")<br />
doc.Write(row.Item(i))<br />
doc.WriteLine("</data></cell>")<br />
Next<br />
doc.WriteLine("</row>")<br />
Next<br />
doc.WriteLine("</table>")<br />
doc.WriteLine("</worksheet>")<br />
Next<br />
doc.WriteLine("</workbook>")<br />
doc.Close()<br />
Catch Ex As Exception<br />
doc.Close()<br />
EC(Ex, "RV, DatasetToExcel")<br />
End Try<br />
End Function</xml>
Hope this helps you on your way.
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi all,
I need to run dos commands like copy,del through my vb.net program.
can any one plz help me with the syntax..
Thanks in advance,
M.Saravana...
|
|
|
|
|
Use the System.Process.Start[^] method.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
vb.net/ .net framework 1.1
i am overriding an inherited datagrid's wndproc and want to catch the message for a change of grid's currentrowindex or currentcell.
does anybody know these messages' constants?
|
|
|
|
|
I have many VS 2003 and 2005 (VB) projects being used within our organization. These applications are windows forms based and not web. The applications are click-once based and when I publish updates to the server, the clients can get updated automatically.
This all works great until a few months later. When installing the applications the screens warn that the application is not a trusted publisher, but I continue to install past this. The application seems to setup a temporary key/certificate that expires in a few months. When I make a change after the expiration date, I can obtain another temporary certificate from the certificate store for a few more months, but all my click once clients crash because the identity has changed.
My boss and his boss say they can buy a certificate for a specific server, but to me that doesn't make sense. Wouldn't you buy a certificate for the company and any application we create can use that certificate no matter where our client is executing the program.
I'm hoping someone can point me in the right direction.
Confused and not trusted
Lost in the vast sea of .NET
|
|
|
|
|
It is possible for you to create your own internal certificate, dammed if I can find the link though, sorry. Note that you can set the key expiry to 2050
When starting a development step 1 is to include the key. As yours is already deployed you are giong to have to
create aand include the new key (set a long expiry date)
remove the existing key
uninstall ALL clients to get rid of the old version
deploy the new version
We had a lot of trouble changing keys on an existing app but persevered till the thing did as it was told - good luck
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If you don't have the link, do you remember how you created the certificate. I'm trying to use the makecert.exe utility, but when I use the parameter to specify a store name to put the certificate in, I don't see it using Certmgr.exe or in Visual Studio. I used the syntax below to at least create a file on my system that I could find and try to pull into my application, but I'm having no success.
makecert.exe -n "CN=VBAppsCertificate" -e 01/01/2070 -b 01/29/2008 -pe testCert.cer
If you remember the process you took to create the certificate please let me know.
I appreciate your help. It really sounds like it is a solution to our problem. I'm just not understanding all the Makecert.exe parameters and once I create the certificate I can't seem to find it.
Thanks
Lost in the vast sea of .NET
|
|
|
|
|
This is from the dev in our group who did the work!
Method 2 : as requested by Mark
1. Create your own certificate and pvKey. using Make Cert
run in .NET command prompt
makecert -n "CN=SomeName" -pe -b 01/01/2007 -e 12/31/2039 -sv c:\SomeName.pvk c:\SomeName.cer
2. Generate pfx:
run in .NET command prompt
pvk2pfx.exe -pvk c:\SomeName.pvk -pi password -spc c:\SomeName.cer -pfx c:\SomeName.pfx -po password -f
I tested this and applied it to a new window application. need to test this out on actual application and deployment...
The advantage of this is we can make use of a single cert for ALL our applications, but we have to do a uninstall for all the existing client and install the app with the new certificate.
References :
Creating and publish own cert
Makecert
pvk2pfx Tool
I hopwe this helps!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks!!!
I followed the steps and created the certificate. I tested it out using a Visual Studio application and it works great!
Thanks again
Lost in the vast sea of .NET
|
|
|
|
|
im trying to use the system.thread.sleep function to display data in a gridview with a 3 second delay however results are not being displayed. It seems to be a problem with the system
===========================================================================================
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.
Dim ds As DataSet = New DataSet
ad.Fill(ds, "tblcustomers")
Dim dtab As DataTable = ds.Tables.Add(0)
Dim dtabclone As DataTable = dtab.Clone()
Dim drow As DataRow = dtab.Rows(0)
dtab.Clone.ImportRow(drow)
GridView1.DataSource = dtab.Clone
GridView1.DataBind()
System.Threading.Thread.Sleep(3000)
drow = dtab.Rows(1)
dtab.Clone.ImportRow(drow)
GridView1.DataSource = dtab.Clone
GridView1.DataBind()
<div class="ForumMod">modified on Monday, January 28, 2008 10:57:23 AM</div>
|
|
|
|