|
don't know if this exist in 2003 but in 2005 there is a tab 'settings' on the properties of you'r project
here you can give a settingname, type, scope and value
this does exactly the same as what you do with the plus side that you can access these 'settings' in code like this:
my.Settings.nameofsetting
it basacly creates a xml file wich can be opened in notepad to alter it
I always use this
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
:-DExcellent, thanks.
Just the thing i was looking for.
|
|
|
|
|
Hola,
I use a package called AutoMod to make simulation models and to send messages from VB to this package teh AutoMod help says to use the next code
Call amxEvents.CallFunction("FsetMotorState", Array(1, Range("B10").Value))
However when I use this code in VB 2005 I get an error message that Array is a type and cannot be used like this.
What do I have to do in VB to get an array as the second argument?
Thanks in advance,
Nasko
See below for the syntax of the CallFunction method.
amx.CallFunction(funcName, params)
The syntax elements are defined as follows:
Syntax Element
Description
amx
An object variable that refers to the AutoMod runtime object.
CallFunction
The name of the method.
funcName
A string that indicates the name of the function in the AutoMod model that you want to call.
params
An array of variants that define the arguments required by the user-defined AutoMod function. The array must have as many values as the AutoMod function has arguments (any extra values are ignored). The variant values are automatically converted to the type of the associated argument in the AutoMod function in the model.
Note: The params syntax element is required. If the AutoMod function you are calling has no arguments, you must still define an empty array. For example:
Call amx.CallFunction("FAmodFunction", Array())
'An empty array is passed to the AutoMod function FAmodFunction
|
|
|
|
|
this is one way:
<br />
Dim a(Range("B10").Value) As Object<br />
a(0) = "mlqjf"<br />
Call amxEvents.CallFunction("FsetMotorState", a)<br />
you can replace object with string,integer,long,...
plus side of object is that you can put anything you want in it
down side the function callfunction might not know what to do with certain objects
hope this helps
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
Thanks,
It worked.. the only thing I had to change was the Excel cell reference and change it to 0 (for a one dimension array).
So the problem is fixed... thanks!
|
|
|
|
|
Hello,
I am adding a column to datagridview.
The column values are numbers or empty string depending of the records returned from my SQL.
When I am sorting the column, it is sorted like string:
123
15
20
25
...
instead of
15
20
25
123
Please help
This is a part of my code:
'add the column to the datagridview
datagridview1.Columns.Add("SCQTYMV", "Qty Moved-In")
'CellFormatting Event
Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
Try
With CType(sender, DataGridView)
If e.ColumnIndex = .Columns("SCQTYMV").Index Then
If .Rows(e.RowIndex).Cells("SCQTYMV").Value.ToString = "" Then
e.Value = ""
Else
e.Value = Cint(.Rows(e.RowIndex).Cells("SCQTYMV").Value)
End If
End If
End With
Catch ex As Exception
MessageBox.Show(ex.Message, "DataGridView1_CellFormatting", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Shay Noy
|
|
|
|
|
Hi All,
I have a table Named Table1 and i have displayed all the records in a datagridview and after i make changes ie.Edit the Datagird i want to save the changes to the same table after i click Update Button.
Can anyone tell me how to do this updation at a time not record by record
Example of what i have done:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Vidya\Visual Studio 2005 Projects\DatasetProject\Sample.mdb"
con.Open()
cmd.Connection = con
cmd.CommandText = "Select * from Table1"
da.SelectCommand = cmd
da.Fill(pTable)
DataGridView1.DataSource = pTable
dr = pTable.NewRow()
dr("Name") = "Doe"
dr("Place") = "John"
dr("Email") = "120"
pTable.Rows.Add(dr)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Cb As OleDb.OleDbCommandBuilder = New OleDb.OleDbCommandBuilder(da)
da.Update(pTable)
MsgBox("Updated")
con.Close()
DataGridView2.DataSource = pTable
End Sub
When i give the da.Update(pTable) or dataset
It gives me following error:
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
I think u have got what i am doing
Thank in advance
|
|
|
|
|
I got the Solution Its because we need to have a primary key for any one of the table
-- modified at 6:41 Wednesday 10th October, 2007
|
|
|
|
|
HiVidya110
Your code is mixedup. i dont see a dataset declaired in your code.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
i made a multi form application.but i don't know how to load a form using a button of main form.
-- modified at 1:22 Wednesday 10th October, 2007
|
|
|
|
|
You create an instance of he form class and call ShowDialog on it. If you didn't know this, you really need to buy a book and work through it, if you want to get anywhere.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
christian is correct
this is the first step in developing windows application..
lots of tutorials are available on net which starts from scratch..
better read them first.
nyways for this particaular problem of yours, here is the code..
in button click event of form1 code like this..
<br />
button1_click()<br />
dim a as new form2 'makes the instance for form2<br />
a.show() ' shows the form2 on clicking of button1<br />
me.close ' for closing of form1(optional) <br />
|
|
|
|
|
I always get an error message on my code below, what is it telling me?
ERROR MESSAGE:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in csrserver2.exe
Additional information: Exception from HRESULT: 0x800A03EC.
HERE IS MY CODE:
Private Sub BuildReport(ByVal stored_func() As String, ByVal report As String)
Dim db1 As New DbTier
db1.DbSource = GetSetting("CSR Server", "Data Source", "CSR", "")
db1.OpenConnection()
Dim i As Integer
Dim xl As Excel.Application
Dim wb As Workbook = mvarExcel.Workbooks.Open(mvarTemplate)
Dim ws As Worksheet
Dim rg As Excel.Range
Dim drd As OleDb.OleDbDataReader
For i = LBound(stored_func) To UBound(stored_func)
ws = wb.Worksheets(i + 1)
ws.Unprotect("crosby")
If i = 0 Then ws.Range("csr_title").Value = mvarCsrDetails(CsrIndex.Title) <---- ERROR HERE
drd = GetDataReader(db1, stored_func(i), mvarCsrDetails(CsrIndex.ID))
drd.Close()
Next
drd = Nothing
db1.CloseConnection()
db1 = Nothing
RaiseEvent OnAfterProcessDone("Saving " & report & ".")
Dim fleOutput As String = mvarOutputPath & UCase(mvarCsrDetails(CsrIndex.Title)) & " " & report & ".xls"
If File.Exists(fleOutput) Then File.Delete(fleOutput)
wb.SaveAs(fleOutput)
wb.Close(False)
End Sub
|
|
|
|
|
What is mvarCsrDetails(CsrIndex.Title) ? It's obviously blowing up the COM object.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
dienadel wrote:
If i = 0 Then ws.Range("csr_title").Value = mvarCsrDetails(CsrIndex.Title) <---- ERROR HERE
drd = GetDataReader(db1, stored_func(i), mvarCsrDetails(CsrIndex.ID))
Should it probably be mvarCsrDetails(CsrIndex).Title
and mvarCsrDetails(CsrIndex).ID ??
|
|
|
|
|
Hello there.
I want to send SMS using a simple FAX Modem through TAP messaging protocol in .NET
What I know is that I need to connect to a message center number (be it free or paid access) through my modem and send it message which will then be sent to corresponding subscriber.
Could anyone guide me on some resources or libraries (probably free).
Thanks.
|
|
|
|
|
Howdy all,
I have a vb.net 2005 windows form. I created a strongly typed dataset, set the table type to 'Details' and dragged the table onto my form. Presto, a bound form which handles updates and even has a record navigator. There is a "+" button to add new reords. Great. Only problem is that the checkboxes on my form don't get set to unchecked/false on the new record. There are six checkboxes, and when I hit the plus button to create a new record the six checkboxes seem to be set based on the last record that was viewed..?? Really. Mmmm.
I checked the db and all six of the SQL 2005 Express fields that the checkboxes are bound to have a default value of ((0)). The check boxes were comming up indeterminate (green block) but now they just take the value from the previous record. I'm also cornfused about the two checkbox properties Checked vs. CheckState. I found a couple MSDN articles about Checked vs. CheckeState, but none of them actually said how to set these properties to get defaults to work..
Anyone know what I'm missing??
Thanks if you can, or even just for reading...
Bad checkbox, bad, bad!!
|
|
|
|
|
hi i know how to import images to button but still i get the edges of the button can u help me how to make the button as in the image
|
|
|
|
|
Maybe what you want is a Panel (or PictureBox), then you can paint/see exactly what you
want; the events would be slightly different of course.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I'm using a streamwriter to output 4 columns of data into a text file. Unfortunately the columns aren't lining up correctly. I've tried using Controlchars.tab & vbTab which do not work. Is there any way to create tabs in the writeline method or would I need to switch to a rich text file for this?
If anyone can help it would be greatly appreciated! Oh yeah I'm using Visual Basic 2003.
Swish
|
|
|
|
|
Where don't they line up ? Tabs only line up if your strings are similar lengths, a long one will skip several tab stops.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Horizontal alignment is bound to fail unless one of two conditions is met:
- all characters have the same width, i.e. the font is non-proportional such as "Courier New";
- you take into account the exact width of each character
On top of that, a TAB character most of the time indicates jumping to the next multiple
of 8 (or 4 or whatever) character positions, again assuming a non-proportional font.
[added]And not: moving to the next column, as would be the case in Word or Excel table[/added]
-- modified at 20:57 Tuesday 9th October, 2007
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
What you're describing is a report text file, not a tab delimited file.
A delimiter is a character or string of characters that seperates fields in a data file. What you're describing is a text file laid out like a report.
|
|
|
|
|
Thanks guy's for replying. The alignment is thrown off by the strings length. And right now padding is still throwing off the alignment. I'm using "Arial" with a font size of "8" and pagesettings.landscape = True.
Dave your right, but I'm having trouble with the layout of the report. Is there a better method of creating reports that have correct alignment in a text, rtf or doc file? Or have the app write to a specific location within the file to better align the report?
Swish
|
|
|
|
|
You have two problems. The first is that different application interpret tabs differently. One may replace a tab character with a bunch of spaces and another might add a bunch of whitespace to hit the next tabstop in it's rendering engine, while another might do something different and add a different amount of whitespace for each tab.
The second is that Arial is a proportional font, meaning that each character is rendered in a cell reletive to the size width of the character. Spaces can be very narrow compared to all the captial letters. Mono-spaced fonts have every character, even spaces, rendered in cells of the exact same width for every character. This means that a space is exactly the same width as, say, a captial W.
If you're writing to a text file (*.TXT), the font doesn't matter since it's not used in the file. What screws up the formatting is the application that is rendering the text. For instance, if you open the file in Notepad and configure Notepad to use the Arial font, the report layout will be severly messed up. Change the font Notepad uses to something like Lucida Console, which is mono-spaced, and column alignment changes.
But now you have a problem with the size of the columns. Assume that you have two lines of text int the file, laid out like this:
sometext[TAB]some more text
someotherlongertext[TAB]even more text
Say Notepad uses a tabstop every one inch. The "sometext" in the first line of the file is shorter than than one inch. The tab will move the cursor to the one mark and then the rest of the line shows up.
Now, for the second line, the first part of it, "someotherlongertext", is longer one inch. Well, the tab will move the cursor to the two inch mark, where the rest of the line will be rendered. And if you haven't figured it out yet, the second column will not be lined up.
There-in lies the problem with using Tabs to do reporting. Each line will have to know how it's going to be rendered and have a variable number of tabs between columns to line them up. Since your application can't possibly know how the text file is going to be rendered, it's impossible to predict the number of tabs needed between columns for each line in the report.
What's the solution?? Use a dedicated reporting tool, like CrystalReports, to generate the report.
If it has to be in a text file, replace the tabs with a known number of spaces. You're going to have to do more work like keeping track of how many characters are in each field and how wide (in characters) each field can hold. Then you can calculate the number of spaces you need to add between those two fields to get them to line up.
Even then, use a proportional font to show the text and the spaces won't even line the columns up.
|
|
|
|