|
Well, my VB6 is a bit rusty, but IIRC, to clear just the TextBox portion of the ComboBox, set the ListIndex to 1, not -1. To clear out the entire ComboBox, it's ComboBox1.Clear().
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
To clear all items in a combo box, you can use cboName.Clear where cboName is the name of the combo box.
|
|
|
|
|
This seems like it should be simple but I could not find any info anywhere to tell me how to do it.
Below is the code I am using in my datagrid and I need to format the number in this cell with ",".
When 123456789 is displayed (not entered) it needs to look like this 123,456,789
.Add(New System.Windows.Forms.DataGridTextBoxColumn)
With .Item(3)
.MappingName = "DriveSize"
.HeaderText = "Drive Size"
.Width = 115
.NullText = String.Empty
End With
If I try to put the .format member is the above code I get an error telling me it is not a member the datagrid columns style.
I have used the .format before to format money, but I don't know why
it won't work here. Can anyone tell me what I need to do to format this
cell?
|
|
|
|
|
I think your looks for something more like this:
Dim newColumn As New DataGridColumnStyle
With newColumn
.MappingName = "DriveSize"
.HeaderText = "Drive Size"
.Width = 115
.NullText = "String.Empty
.Format = "N"
End With
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you for your response. I had already been trying to use the .format member but with the way I was coding the columns it would not work. I would get an error telling me it was not a member of that object.
I finally tried a different way of coding for the columns (similar to yours) but I had to make other additional changes and I finally got it to work.
I appreciate your help. You made me rethink how I was approaching the column coding.
|
|
|
|
|
Has anyone got a routine to solve an optimization problem using the Simplex method?
Although I am aware of the Process to solve a Standard Maximization Problem using the Simplex Method, I have not even attempted to code it as I imagine that it is available on line.... and hopefully in vb 6 or .net
My application is to optimize the utilization (overall efficiency) of multiple equipment blocks based on block power, within certain constraints (numerical example as follows):
Maximize ntotal = ax + by + cz subject to
x + y + z <= 500
x <= 250
x >= 100
y <= 110
y >= 100
z <= 250
z >= 100
However, the coefficients a, b and c are functions as follows:
a = f(x), b=f(y) and c=f(z).
My planned approach is to use the standard simplex solution and iterate until the differences between two consecutive solutions for x, y and z are less than a defined limit. The values of a, b and c will be determined from a polynmial between each iteration based on the resultant x, y and z.
Finally, although I will use the routine locally (vb), I intended to run the calculation on line on data within a mySQL database using PHP.
Thanks for reading this and I will really appriciate any help!
karmond
|
|
|
|
|
You'd get much better results Googling for "Simplex method optimization".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am using the following code from :http://www.kjmsolutions.com/datasetarray.htm[^]
to export data from a datagrid to Excel. The issue I have is that in my grid I have a field which holds the value: 00124544545454545 which represents a code.
Excel displays: 1+32323 a scientific number. I am at a loss on how to force a format to a cell to display this as text. The datagrid can show to datasets that differ in columns and thus it must be dynamic.
Any ideas?
Dim Excel As New Excel.Application
Dim oBook As Excel.Workbook
Dim WSheet As New Excel.Worksheet
Dim rows As Integer = dsDataset.Tables(0).Rows.Count
Dim columns As Integer = dsDataset.Tables(0).Columns.Count
Dim r As Integer
Dim c As Integer
Dim DataArray(rows, columns) As Object
Dim sString As String
WSheet = Excel.Workbooks.Add.Worksheets.Add
Excel.Visible = True
For c = 0 To columns - 1
DataArray(r, c) = dsDataset.Tables(0).Columns.Item(c).ColumnName
For r = 0 To rows - 1
DataArray(r, c) = dsDataset.Tables(0).Rows(r).Item(c)
Next
Next
'Transfer record data from array to Excel
WSheet.Range("A2").Resize(rows, columns).Value = DataArray
Dim columns2 As Integer
Dim columns3 As Integer = 1
For columns2 = 0 To dsDataset.Tables(0).Columns.Count - 1
WSheet.Cells(1, columns3).Value = dsDataset.Tables
(0).Columns(columns2).ColumnName
columns3 = columns3 + 1
Next
Cheers,
Scott
|
|
|
|
|
my mind is slipping; that and I'm new to VB.Net. I declared the array as string and voila!
Cheers,
Scott
|
|
|
|
|
Hi,
My application consists of a page containing textboxes - in some of which you type English and in some, Thai (Thailand's language) - which then gets saved into a MySQL DB. Now when you navigate between these textfields, you've to press Left-Alt+Shift (or whatever key config your system is set to) - to switch back and forth between these two languages. Any of you know a method by which I can make the system switch language on its own - depending on WHICH textfield has focus currently ? That way my user won't have to stop at every field and switch the language manually and would save up ona whole lot of extra keystrokes, besides making the app. really cool Anybody with any kind of suggestions, most welcome. (Platform: Frontend:VB.NET Client --> Backend: MySQL-4.1.9 on Fedora Core 2)
Thanks a million
PeoPLe aRe cRazY anD tiMeS aRe sTRaNGe, i'M LoCKeD iN tiGhT, i'M OuT oF raNGe, i uSeD t0 caRe BuT - thiNGs haVe chaNGeD.
|
|
|
|
|
Is the machine.config file only available to Asp.Net applications? I am working on a console app and have added a setting to the file, but it isn't pulling using ConfigurationSettings.AppSettings("KeyName").ToString. I would appreciate any thoughts on this. Thank you.
Jason W.
|
|
|
|
|
No it's not.
ConfigurationSettings.AppSettings() does not look in the machine.config file anyway. It will look in the applications config file, which should have the same name as the .EXE file with ".config" appended to it. For example, if your application's .EXE is called MyApp.exe, the corresponding configuration file will be called MyApp.exe.config and reside in the same directory as the .EXE. This is the only file AppSettings will look in.
You can find more on these files on MSDN here:
Machine Configuration Files[^]
Application Configuration Files[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello! I need convert to(from) Julian Date Format from(to) Calendar Date.
Is there built in algorithm that allow to do this?
Now I do so:
' convert Calendar Date to Julian Date Format
Private Function GetJD(ByVal vDate As Date) As Integer
Dim y As Integer = vDate.Year
Dim m As Integer = vDate.Month
Dim d As Integer = vDate.Day
If m > 2 Then
m = m + 1
Else
y = y - 1
m = m + 13
End If
Dim JulianDate As Integer = Math.Floor(Math.Floor(365.25 * y) + Math.Floor(30.6001 * m) + d + 1720995)
JulianDate += 2 - Math.Floor(0.01 * y) + Math.Floor(0.25 * Math.Floor(0.01 * y))
Return Math.Floor(JulianDate - 0.5)
End Function
' convert Julian Date to Calendar Date Format
Private Function GetCD(ByVal JD As Integer) As Date
Dim g1, g2, g3, g4, g5 As Integer
Dim tmp As Integer = Math.Floor(((JD - 1867216.0) - 0.25) / 36524.25)
g1 = JD + 2 + tmp - Math.Floor(0.25 * tmp)
g2 = g1 + 1524.0
g3 = Math.Floor(6680 + ((g2 - 2439870) - 122.1) / 365.25)
g4 = Math.Floor(g3 * 365.25)
g5 = Math.Floor((g2 - g4) / 30.6001)
Dim d As Integer = Math.Floor(g2 - g4 - Math.Floor(g5 * 30.6001))
Dim m As Integer = Math.Floor(g5 - 1.0)
If m > 12 Then m -= 12
Dim y As Integer = Math.Floor(g3 - 4715.0)
If m > 2 Then y -= 1
If y <= 0 Then y = Abs(y - 1)
Return Date.Parse(d & "/" & m & "/" & y)
End Function
Thanks.
|
|
|
|
|
There's a prebuilt class in VB.NET named JulianCalendar that does exactly what you're looking for. JulianCalendar has several methods that'll take any conventional Gregorian date, convert it to a Julian format and send you back the result in any format you wish. I found an example for this in the MSDN2003 libraries. I'm pasting it here for your reference:
===========================================================
' The following code example displays the values of several components of a DateTime in terms of the Julian calendar.
Imports System
Imports System.Globalization
Public Class SamplesJulianCalendar
Public Shared Sub Main()
' Sets a DateTime to April 3, 2002 of the Gregorian calendar.
Dim myDT As New DateTime(2002, 4, 3, New GregorianCalendar())
' Creates an instance of the JulianCalendar.
Dim myCal As New JulianCalendar()
' Displays the values of the DateTime.
Console.WriteLine("April 3, 2002 of the Gregorian calendar equals the following in the Julian calendar:")
DisplayValues(myCal, myDT)
' Adds two years and ten months.
myDT = myCal.AddYears(myDT, 2)
myDT = myCal.AddMonths(myDT, 10)
' Displays the values of the DateTime.
Console.WriteLine("After adding two years and ten months:")
DisplayValues(myCal, myDT)
End Sub 'Main
Public Shared Sub DisplayValues(myCal As Calendar, myDT As DateTime)
Console.WriteLine(" Era: {0}", myCal.GetEra(myDT))
Console.WriteLine(" Year: {0}", myCal.GetYear(myDT))
Console.WriteLine(" Month: {0}", myCal.GetMonth(myDT))
Console.WriteLine(" DayOfYear: {0}", myCal.GetDayOfYear(myDT))
Console.WriteLine(" DayOfMonth: {0}", myCal.GetDayOfMonth(myDT))
Console.WriteLine(" DayOfWeek: {0}", myCal.GetDayOfWeek(myDT))
Console.WriteLine()
End Sub 'DisplayValues
End Class 'SamplesJulianCalendar
'This code produces the following output.
'
'April 3, 2002 of the Gregorian calendar equals the following in the Julian calendar:
' Era: 1
' Year: 2002
' Month: 3
' DayOfYear: 80
' DayOfMonth: 21
' DayOfWeek: Wednesday
'
'After adding two years and ten months:
' Era: 1
' Year: 2005
' Month: 1
' DayOfYear: 21
' DayOfMonth: 21
' DayOfWeek: Thursday
===========================================================
Hope this helps
PeoPLe aRe cRazY anD tiMeS aRe sTRaNGe, i'M LoCKeD iN tiGhT, i'M OuT oF raNGe, i uSeD t0 caRe BuT - thiNGs haVe chaNGeD.
|
|
|
|
|
want to insert a string in html login screen text box from vb
roy
|
|
|
|
|
Hello To All,
How can i declare a variable at runtime by a name got as string. Like:
On Runtime:
I got string "txtFldName"
So I have to declare it at runtime as:
dim txtFldName as object
Thanks in advance
Sheel
|
|
|
|
|
You can't really and there's no real reason to do so either. What are you really trying to accomplish?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
dear friend
Actually i have a smart card developed with vb application interface. It has a unique no in it. I want to pass that number in koha log in screen . Koha is a open source lib software built with cgi perl. whenever i will insert the smart card in the reader the specific id no will go to the text box of koha log in screen .
url:"http://hlt.katipo.co.nz/cgi-bin/koha/mainpage.pl"
My question is the id nomcan be shown in a textbox or label of an application in vb, the url can be invoked with the help of web browser.In the text box of that login screen i want to show the id no. HOW?
Thanks in advance
Rana
|
|
|
|
|
I have added a COM type library to my VB project and can see some COM objects in the object browser. I do this:
Dim myobj As New Plugin 'Plugin is COM object in object browser
myobj now has a number of methods available to it but it also has properties. How can I access these properties? There are no methods on the COM object to get the properties but I know they are there.
I start to type myobj. and then get a menu of methods and properties to call. What can I do with properties? One of them is called Name which must store the name of the plugin which is what I want to get.
|
|
|
|
|
If those properties are not public, and it doesn't sound like they are, then you're not going to get at them. Sure, private properties show up in the browser, but that doesn't mean you can use them.
Everything you can get to is going to be revealed when you hit the period key after typing myobj .
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In my VB .NET project I use Access 2003 method ImportXML and ExportXML.
Is there any way that I could still use these methods without having Access 2003 installed? Could I install only some dlls in order to achieve this
|
|
|
|
|
Nope. If your going to bind your application to Access, it better be installed when you run it. You can't just use the functions you want without having everything else above that in the object tree also present.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
if i have a ascii file, example:
2 4
3 40
42 56
etc...
how to open this file?
how to show this file in listview or datagrid?
how to save in a ascii file if i have this data
thank
|
|
|
|
|
This stuff is much nicer in C++, but in VB.NET you can still use the System.IO namespace to read and write files. In fact, a quick google will overload you with the information you need.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Use the following Code. Put an AsciiFile.txt with the data
2 4
3 40
42 56
in the applications path
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents ListView1 As System.Windows.Forms.ListView
Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader
Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.ListView1 = New System.Windows.Forms.ListView
Me.ColumnHeader1 = New System.Windows.Forms.ColumnHeader
Me.ColumnHeader2 = New System.Windows.Forms.ColumnHeader
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(200, 232)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'ListView1
'
Me.ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader2})
Me.ListView1.Location = New System.Drawing.Point(8, 8)
Me.ListView1.Name = "ListView1"
Me.ListView1.Size = New System.Drawing.Size(264, 192)
Me.ListView1.TabIndex = 1
Me.ListView1.View = System.Windows.Forms.View.Details
'
'ColumnHeader1
'
Me.ColumnHeader1.Width = 120
'
'ColumnHeader2
'
Me.ColumnHeader2.Width = 135
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.ListView1)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str1 As String
Dim i As Integer = -1
Dim SReadLine As Stream
SReadLine = File.OpenRead(Application.StartupPath & "\AsciiFile.txt")
Dim SrReadLine As StreamReader = New StreamReader(SReadLine, _
System.Text.Encoding.ASCII)
SrReadLine.BaseStream.Seek(0, SeekOrigin.Begin)
While (SrReadLine.Peek() > -1)
i += 1
str1 = SrReadLine.ReadLine().ToString
Dim str2() As String = str1.Split()
Me.ListView1.Items.Add(str2(0))
Me.ListView1.Items(i).SubItems.Add(str2(1))
End While
SrReadLine.Close()
End Sub
End Class
|
|
|
|