|
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.
|
|
|
|
|
Thanks Dave for taking the time to explain. Though I've never worked with Crystal Reports I'm going to give it a try. Thanks!;)
Swish
|
|
|
|
|
example:
suppose i have 3 forms
and sequence of opening is form1->form2->form3
form1 is MDi parent, form3 is MDi child
on clickin of form1, form2 gets open which takes some values from user retreives the data and accordingly opens form 3..
ma doubt is from form1, form2 can b made mdi child
but from form 2, how form3 will b made child of form1..???
thanks
|
|
|
|
|
From form2 use the following
Dim form As New Form3
form.MdiParent = Me.MdiParent
form.Show()
</code>
-- modified at 21:24 Tuesday 9th October, 2007
Mike Lasseter
|
|
|
|
|
its not working man...
form3 is not becoming child of form1..
|
|
|
|
|
Yes it does work. The code I pasted should be run on form2. Paste you code for each form and I will tell you what you are doing wrong.
Mike Lasseter
|
|
|
|
|
i am using VS 2005.
when i am writin this code in button click event of form2,
form 3 gets open but not as a child of form1..
it opens as individual form...
|
|
|
|
|
The code I posted works, post your code for each form.
Mike Lasseter
|
|
|
|
|
form1 is mdiparent with ismdicontainer as true
coding for form1
button_click event<br />
dim frm2 as new form2<br />
frm2.show()<br />
now in button click event in form2
<br />
dim frm3 as form3<br />
frm3.mdiparent=me.mdiparent<br />
frm3.show()<br />
this was your method..
the method which i am using is in form2 i code
button_click()<br />
dim frm3 as new form3<br />
frm3.mdiparent= form1<br />
frm3.show()<br />
this one works but only when form1 is startup form.
if form1 is any intermediate form and startup form is any other form then this method doesnt works..
any solution..??
thanks
|
|
|
|