|
How to sum the fields in a Windows Forms DataGrid control and then display the calculated totals in a footer by using Visual Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;EN-US;836672
|
|
|
|
|
thank u for ur suggestion ........
i am looking for having total field not only at the footer but on each and every row
|
|
|
|
|
summers over school is in, yet again.
heh, well, for the past 5 months or so on my school vacation, i hadnt used VB.net. now im lost again :S
first off: im not asking you to do my homework, im asking for help..
my project is as follows: two text boxes, and one button. i need to write a program to find the difference (number of days) between 2 entered days (ex, day1 = monday, day2= friday, difference = 4 days.
i have an enum like this:
Private Enum DaysOfWeek
Monday = 1
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
End Enum
i also have 2 variables that i made of the enum type (startDay and endDay). i set startDay and endDay's value = their respective textboxes.text, which the user enters a day of week. i get cast from string to integer error (i know, because enums must only be integer values, right?)
so how can i do this? (sorry if being broad, again, im not asking you to do my homework for me, im asking for help.)
thank you
------------------------
Jordan.
III
|
|
|
|
|
Instead of casting string to enum use the Enum.Parse method to convert the string to Enum.
|
|
|
|
|
im off to bed, but, i WILL definetly check it out. iv never heard of that method before, ill look into it!
thank you very much!
------------------------
Jordan.
III
|
|
|
|
|
Hello everybody. I am new to VB.NET and i have the following code:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim objPrint As New System.Drawing.Printing.PrinterSettings
Dim strItem As String
Dim strPrinters As String
For Each strItem In objPrint.InstalledPrinters
cmbPrinter.Items.Add(strPrinters & strItem)
Next
End Sub
I am able to get all the list of available printers and i want when i click on one of them a list to be filled with all available paper sizes for that printer. So far no luck. Can anyone help me. Thank you in advance...
Trying to find the way
|
|
|
|
|
.NET Framework Class Library
PrinterSettings.PaperSizes Property
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawingprintingprintersettingsclasspapersizestopic.asp
|
|
|
|
|
Thank you Anonymous. It has all the information needed. But still I can't seem to be able to make the paper size combobox to get the papers sizes of the printer that i have clicked on the printer combobox. I can only seem to be able to get the default's one. ARGGG!!! What am i doing wrong?
HEEEEELPPPPP
Trying to find the way
|
|
|
|
|
Without seeing your code, it's impossible to tell you. PaperSizes returns a collection. Are you enumerating the collection it returns or just using the first item from it?
We need to see the code...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok here is the code so far:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim objPrint As New System.Drawing.Printing.PrinterSettings
Dim strItem As String
Dim strPrinters As String
For Each strItem In objPrint.InstalledPrinters
cmbPrinter.Items.Add(strPrinters & strItem)
Next
End Sub
Private Sub cmbPrinter_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPrinter.SelectedIndexChanged
' Add list of supported paper sizes found on the printer.
Dim searchstring As String
Dim SearchChar As String
Dim MyPos As Integer
Dim i As Integer
Dim pkSize As System.Drawing.Printing.PaperSize = Nothing
SearchChar = "A4"
For Each pkSize In printDoc.PrinterSettings.PaperSizes
lstPaper.Items.Add(pkSize.PaperName)
Next
For i = 0 To lstPaper.Items.Count - 1
lstPaper.SelectedIndex = i
searchstring = lstPaper.SelectedItem()
MyPos = InStr(searchstring, SearchChar)
If MyPos = 0 Then
lstPaper.Items.Remove(0)
Else
paperToUse = searchstring
End If
Next
updateDisplay()
End Sub
I can fill the combobox of the printers and the list box of the papers. BUT when i click on another printer the program DOSEN'T give me the list of the paper sizes on the new selected printer. It's like it stucks in the paper sizes of the default printer...
HEEEEEEEEEEEEEEEEEEEEEEEEEELP!!!
Trying to find the way
|
|
|
|
|
I was able to load the datagrid correctly and fill it. What I am trying now to accomplish is how to highlight a whole row when I user either tabs down or clicks the row. As of now it highlights just one column of the row. I want to be able to highlight the whole row and have a user click the row to get the info the user is requesting.
Thanks
Beginner in ASP.Net and VB.Net
|
|
|
|
|
.NET Framework Class Library
DataGrid.Select Method (Int32)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsDataGridClassSelectTopic1.asp
|
|
|
|
|
That is the right track but if a user clicks on (row 1 column 3) then all the data for (row 1 column 1) and (row 1 column 2) disappears and the whole row is highlighted. I have seen this done in programs so I know its possible.
Right now my rows alternate colors with light blue and baby blue. When a user selects a row they want to view, then I want to highlight that row to stand out like with a yellow or even a darker blue to make it look different from the rest.
Thanks
Beginner in ASP.Net and VB.Net
|
|
|
|
|
Highlight an Entire Row in VB.NET WinForms DataGrid
description:
http://www.freevbcode.com/ShowCode.asp?ID=5746
source:
http://www.freevbcode.com/source/HighlightingRowInDataGrid.zip
|
|
|
|
|
you've probably sorted it now but a really simple way would be
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
Dim oCell As DataGridCell
oCell = DataGrid1.CurrentCell
Dim lRowNum As Long
lRowNum = oCell.RowNumber
With DataGrid1
.Select(lRowNum)
End With
End Sub
"If i was king cigarettes would be free."
|
|
|
|
|
ok im relativly new
but im making a program using the inputbox's
and the inputnox colors and font is differnt than the rest of the program
if you know what to do please help
Beaker Rules!
|
|
|
|
|
You could make your own input box.
Make 2 forms in a blank project
Drag a CommandButton onto Form1
and a TextBox onto form2
'FORM1 CODE
Public Function InputBox2() As String
Form2.Show vbModal
InputBox2 = Form2.Variable
End Function
Private Sub Command1_Click()
Command1.Caption = InputBox2()
End Sub
'FORM1 CODE
'FORM2 CODE
Public Variable As String
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Variable = Text1.Text
Unload Me
End If
End Sub
'FORM2 CODE
Pretty simple, from there u can add whatever u want
|
|
|
|
|
|
not sure if anyone still uses this, but I installed .NetFramework 1.0 sp1
(released, aug31,2004) and after that I was getting some javascript errors.
I have a user control inside a webform. basically have login.ascx inside login.aspx. the login.ascx contains the <form> tag.
<form id="Form1" runat="server">
before the sp1 the form would render like this...
<form name="_ctl7:Form1" method="post"
action="Login.aspx"
id="_ctl7_Form1">
after sp1 it was this...
<form name="__aspnetForm" method="post"
action="login.aspx"
id="__aspnetForm">
It is killing some of my javascript where I look for
"_ctl:Form1"!
any help would be greatly appreciated.
Ganesan Muthiah
email:ganerathu@hotmail.com
|
|
|
|
|
Your question would be better handled in the ASP.NET Forum.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am trying to get a url with MSXML2.ServerXMLHTTP but turkish chacters in the url making problem that they seem as '?' how could I solve this problem.
Here is the my code....
<%<br />
Response.Buffer = true<br />
<br />
Dim objXMLHTTP, xml, text<br />
<br />
Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")<br />
<br />
xml.Open "GET", "http://www.bektekeri.com/include/articles/article14.php", false<br />
xml.setRequestHeader "Content-Type", "xml/text"<br />
xml.setRequestHeader "characterset","windows-1254"<br />
xml.setOption(0) = 1524<br />
xml.Send<br />
<br />
text = xml.responsetext<br />
response.Write text<br />
<br />
Set xml = Nothing<br />
<br />
%>
karanba
|
|
|
|
|
Your question would probably be better handled in the XML Forum[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok im new to vbscript so i need a bit of help with linking to sub/function thats on a VB6 form from VBScript
i.e.
Sub Hey(Name)
If len(name) < 15 then
addq(name)
end if
End Sub
Thats basic,
Addq being the sub i want to link to in VB6
And Hey being called like thus
Private Sub Command1_Click()
sc.AddCode Text1.Text
Username = "QWRQWRQWRQWR"
sc.Run "Hey", Username
End Sub
Text1.Text containing that VBScript above.
Thanks for the help
|
|
|
|
|
I don't believe you can using the method that you are for running the script. The script engine has no method of retrieving the reference to the running Form object in VB6 and passing that reference to the script.
I could be wrong though...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
I don't believe you can using the method that you are for running the script. The script engine has no method of retrieving the reference to the running Form object in VB6 and passing that reference to the script.
I could be wrong though...
I believe you are wrong becasue i've seen it working using a method some what like that...
So there must be a way to do it
|
|
|
|