|
sazd1 wrote: so there is no option for alignment of data in columns in listbox.
It's meant as a list. If you try this;
ListBox1.MultiColumn = True
Dim i As Integer
For i = 1 To 40
ListBox1.Items.Add("Test " & i)
Next i You'll get a list of multiple items, stacked like this (that's assuming that your list has a height that has enough room for six items);
Test 1 Test 7 Test 13
Test 2 Test 8 Test 14
Test 3 Test 9 Test 15
Test 4 Test 10 Test 16
Test 5 Test 11 Test 17
Test 6 Test 12 Test 18
sazd1 wrote: to add spaces is difficult.
I have made you a short example on that;
[...]
ListBox1.MultiColumn = False
ListBox1.Font = New Font( _
System.Drawing.FontFamily.GenericMonospace, _
ListBox1.Font.Size, _
ListBox1.Font.Style, _
ListBox1.Font.Unit)
Dim j As Integer
For j = 1 To 20
ListBox1.Items.Add(AsFixedColumnText("Test " & j, 8) & _
Space(3) & _
AsFixedColumnText(Date.Now(), 8) & _
Space(3) & _
AsFixedColumnText("Hello", 3))
Next j
End Sub
Public Function AsFixedColumnText(ByVal text As String, ByVal length As Integer)
If String.IsNullOrEmpty(text) Then
Return Space(length)
Else
Return (text & Space(length)).Substring(0, length - 1)
End If
End Function
This should give you an output that's formatted in columns, similar to this;
Test 1 5/7/200 He
Test 2 5/7/200 He
Test 3 5/7/200 He
Test 4 5/7/200 He
Test 5 5/7/200 He
Test 6 5/7/200 He
Test 7 5/7/200 He
Test 8 5/7/200 He
Test 9 5/7/200 He
Test 10 5/7/200 He
Test 11 5/7/200 He
Test 12 5/7/200 He
Test 13 5/7/200 He
Test 14 5/7/200 He
Test 15 5/7/200 He
Test 16 5/7/200 He
Test 17 5/7/200 He
Test 18 5/7/200 He
Test 19 5/7/200 He
Test 20 5/7/200 He
Still, I don't think that this is the ideal solution. Is there any way that you can promote the ListBox to a ListView ? Or even a DataGridView ?
I are troll
|
|
|
|
|
Google for TabbedListbox
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello All,
How can i got the result of two numbers while numbers length is greater then 20 digit.
which variable to use for it.
Thanks
If you can think then I Can.
|
|
|
|
|
double or possibly long
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks Dear
If you can think then I Can.
|
|
|
|
|
A long can't handle a number with 20 digits, and a double doesn't have more than 17 significant digits (losing precision beyond that).
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
if you have a data type that is already holding each of your two numbers, and asuming both have the same polarity, then that same data type can hold their difference for sure.
20 decimal digits is about the limit a long can hold; and it is beyond what a double can do. If you need more precision, you will have to switch to some "big integer" class; there are several around (of varying functionality and quality); there will be one included in .NET 4.0
|
|
|
|
|
Decimal.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
In VFP, Each control added to the form has a Init Method, where this is the first Method to be executed when the form runs.
Suppose I want to add A combo, and add 3 item to it.
I tried to search for method in vb and could not find it, so the only place I found to put my code for a form control is in the Form_Load()
Is there a method belong to the control so I can put my initial code in or just in Form_Load() ?
TIA
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
When the code behined is generated there is a method like public partial class formname in that method will be something like InitializeComponent(); put your initialisation after that. Or in the form load.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Further to my recent post.....does anyone have a working .net Server Control (code) for Virtual Earth that I can use? I want to see how other programmers create Server Controls. Most of what I've done is through trial and error
|
|
|
|
|
Ask in the ASP.NET Forum.
|
|
|
|
|
Public Declare Function ExtFloodFill Lib "gdi32" Alias "ExtFloodFill" (ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer, ByVal crColor As Integer, ByVal wFillType As Integer) As Integer
I want above API use with VB.NET. But I can't found hdc property in Picturebox control.
Any body tell me how to use this function.
|
|
|
|
|
Take a look at this[^], and see if you can work out how to apply it to a PictureBox.
BTW, unless you absolutely have to, avoid PictureBox. It is only good for displaying a picture that you will never, and I mean never, interact with.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi ,
PictureBox1.Handle is how you get the handel (hdc)
you will require to change the declaration a bit , the new declaration of the API
should be as following
Public Declare Function ExtFloodFill Lib "gdi32" Alias "ExtFloodFill"
(ByVal hdc As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal
crColor As Integer, ByVal wFillType As Integer) As Integer
Hope this helps
Let me know if you need further help
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Hi,
I think I got this ASP.NET Server Control code from here. It works in Firefox but not in IE. Does anyone know why?
ASP.net 2.0
Language - VB
Site Content Manager – Dot Net Nuke
VB Code:
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.ComponentModel
Imports System.Collections
Public Class MapControl
Inherits WebControl
#Region "Variables"
Private _dataSource As IEnumerable
Private _VarMap As String = "var map = null;"
Private _GetMapOpen As String = "function GetMap(){"
Private _CloseBracket As String = "}"
Private _LoadMap As String = "map.LoadMap();"
Private _PinId1 As String = "var pinid1=0;"
Private _Locs1Array As String = "var locs1 = new Array;"
Private _MapAddPushpin As String = "map.AddPushpin(pin);"
Private _IncrementPinId As String = "pinid1++;"
Private _Latitude As String = "47.6"
Private _Longitude As String = "-122.33"
Private _ZoomLevel As Integer = 10
#End Region
#Region "Properties"
Public Property DataSource() As IEnumerable
Get
Return _dataSource
End Get
Set(ByVal value As IEnumerable)
_dataSource = value
End Set
End Property
<Browsable(True), Category("Position")> _
Public Property Latitude() As String
Get
Return _Latitude
End Get
Set(ByVal value As String)
_Latitude = value
End Set
End Property
<Browsable(True), Category("Position")> _
Public Property Longitude() As String
Get
Return _Longitude
End Get
Set(ByVal value As String)
_Longitude = value
End Set
End Property
<Browsable(True), Category("Position")> _
Public Property ZoomLevel() As Integer
Get
Return _ZoomLevel
End Get
Set(ByVal value As Integer)
_ZoomLevel = value
End Set
End Property
#End Region
#Region "String Functions"
Private Function NewNamedMap(ByVal MapName As String) As String
Return "map = new VEMap('" & MapName & "');"
End Function
Private Function NewLocation(ByVal longatude As String, ByVal latitude As String) As String
Return "var loc = new VELatLong(" & longatude & "," & latitude & ");"
End Function
Private Function AddPushPin(ByVal Arr As String, ByVal Location As String) As String
Return Arr & ".push(" & Location & ");"
End Function
Private Function ForOpen(ByVal Arr As String) As String
Return "for (i=0; i < " & Arr & ".length; i++){"
End Function
Private Function RunBestMap(ByVal Arr As String) As String
Return "DoBestMap(" & Arr & ");"
End Function
#End Region
#Region "Map Strings"
Private Function MapWithDatasource() As String
Dim str As String = ""
str &= "<script "
str &= "type=""text/javascript"""
str &= ">"
str &= _GetMapOpen & _VarMap & NewNamedMap("MyNewMap") & _LoadMap
str &= _Locs1Array
str &= _PinId1
Dim DataEnum As IEnumerator
DataEnum = DataSource.GetEnumerator()
Dim i As Integer = 0
'str &= ForOpen("locs1")
While (DataEnum.MoveNext())
Dim st1, st2, st3, st4 As String
st1 = DataEnum.Current
DataEnum.MoveNext()
st2 = DataEnum.Current
DataEnum.MoveNext()
st3 = DataEnum.Current
DataEnum.MoveNext()
st4 = DataEnum.Current
str &= NewLocation(st1, st2)
str &= AddPushPin("locs1", "loc")
str &= "var pin = new VEPushpin(" & i.ToString & ", locs1[" & i.ToString & "], null, '" & st3 & "', '" & st4 & "');"
str &= "map.AddPushpin(pin);"
i += 1
End While
'str &= _CloseBracket
str &= "map.SetMapView(locs1);"
str &= _CloseBracket
str &= "</script>"
Return str
End Function
Private Function BasicMap() As String
Dim str As String = ""
str = "<script ""language=""JavaScript"">"
If Latitude <> "" And Longitude <> "" Then
str &= _GetMapOpen & _VarMap & NewNamedMap("MyNewMap") & _
"map.LoadMap(new VELatLong(" & Latitude.ToString & "," & Longitude.ToString & "), " & ZoomLevel.ToString & ",'h' ,false);" & _CloseBracket
Else
str &= _GetMapOpen & _VarMap & NewNamedMap("MyNewMap") & _LoadMap & _CloseBracket
End If
str &= "</script>"
Return str
End Function
#End Region
#Region "Control Methods"
Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
MyBase.OnPreRender(e)
Dim meta As String = "<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"">"
Dim link As String = "<script type=""text/javascript"" src=""http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2""></script>"
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "Meta", meta)
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "Link", link)
Controls.Add(New LiteralControl("<div id='MyNewMap' style=""position:relative; width:600px; height:300px;""></div>"))
If Not _dataSource Is Nothing Then
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "OnLoad", MapWithDatasource)
Else
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "OnLoad", BasicMap)
End If
End Sub
Protected Overrides Sub OnDataBinding(ByVal e As EventArgs)
Controls.Clear()
End Sub
#End Region
End Class
|
|
|
|
|
Probably do better in the ASP forum.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi,
i am using multiple tables to create a report since Microsoft report viewer does not allow multiple tables so i have used a stored procedure with parameter. i have refreshed my data set and now my dataset also contains the data table for the stored procedure.the .rdlc also has been successfully linked with the columns and rows of the stored procedure data table. in the form where i am using the report viewer in the load event i have used the table adapter for the stored procedure to fill the stored procedure data table with the values, i am also passing the parameter to the table adapter.
but on doing this i get an error:
Error 1 Value of type 'innoerp.innoerpDataSet1.StoredProcedure2DataTable' cannot be converted to 'innoerp.innoerpDataSet.StoredProcedure2DataTable'. C:\Documents and Settings\prog- 2\My Documents\Visual Studio 2008\Projects\innoerp1\innoerp1\Daily Sales Report.vb 11 47 innoerp1
here innoerp is the name of my database and storedprocedure2 is the storedprocedure
please help!!!!!!!!!!
thanks in advance
|
|
|
|
|
sourav_bhargava wrote: StoredProcedure2DataTable
I have no idea what the method does for you but your problem has NOTHING to do with the report viewer. You probably have a line of code like:
StoredProcedure2DataTable = getTableFromXXXXXXX
Change it to
StoredProcedure2DataTable = (StoredProcedure2DataTable)getTableFromXXXXXXX
I beleive you need to box the second half!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
thanks Mycroft Holmes for the reply.
i think you are right, but i actually am not being able to figure this one out.
here is the code i have used in form load
Imports Microsoft.Reporting.WinForms.ReportDataSource
Public Class DailySalesReport
Private Sub Daily_Sales_Report_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dt As New DataTable
'TODO: This line of code loads data into the 'innoerpDataSet.salesmen' table. You can move, or remove it, as needed.
Me.SalesmenTableAdapter.Fill(Me.innoerpDataSet.salesmen)
Me.ReportViewer1.LocalReport.DataSources.Clear()
Me.StoredProcedure2TableAdapter1.Fill(InnoerpDataSet1.StoredProcedure2, ComboBox1.Text)
Me.ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("dt", dt))
Me.ReportViewer1.RefreshReport()
End Sub
End Class
this is giving the error i have earlier mentioned.
|
|
|
|
|
Going to be difficult, I never work with the tableadapters, horrible things they are. What type does Me.StoredProcedure2TableAdapter1.Fill expect as it's forst parameter. Presumably salesman fills Ok so what are the differences between the 2 methods!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
fill wants data table of as the first parameter
|
|
|
|
|
thank you every one the problem has been resolved .
i just created another dataset specially to keep the data table values and then filled the table adapter and then refreshed the report viewer this solved the problem.
|
|
|
|
|
hello every one
i want to add columns in checklisbiox like listview so that i can make the width of column to zero which will be not visible to end user is there any code in .net which is helpful to me. in vb i had used checklistbox for the same and it worked but in .net the same is not working.
please suggest what to do..
thank u in advance..
|
|
|
|
|
I'm using instructions from Bob Powell's website [^] to save an edited image back to its original file name. Here's my problem:
This is a batch operation with multiple images receiving the same changes. Often, I'll get the GDI+ generic error caused when the original image in memory has not been disposed. The new image to be written back to the original is created one line before disposing of the original (locked) bitmap:
newImg = CreateNewImage(tmpBMP, newW, newH) 'created in function elsewhere in app
tmpBMP.Dispose()
'Following the above code is the code that sets the format and saves the image
The error does not occur if I do the following instead:
newImg = CreateNewImage(tmpBMP, newW, newH)
tmpBMP.Dispose()
If tmpBMP.Equals(Nothing) Then
MsgBox("NOTHING")
End If
'Following the above code is the code that sets the format and saves the image
The graphics object used to draw the new image in memory is disposed in the called function.
Am I correct in assuming that my app isn't getting enough time to dispose of the original before trying to write back to it? The msgbox NEVER actually opens either way, which also confuses me (I'm a newbie to GDI+).
If I do need to be sure the app has enough time to dispose of the original, what is a good way to create the necessary delay? Any suggestions appreciated.
AB
|
|
|
|