|
Can you specify how you make it invisible?
Have you setted an icon to the form?
Also, consider investigating the .ShowInTaskBar property.
Best regards,
Pablo.ar
|
|
|
|
|
well it won't be really invisible just Minimized in the start tool bar, but in the tool bar the program will still fun until u open in from the tool bar and click stop.
Ex. say A instant messager, it still runs eeven though u x-ed it out. (runs in the start toolbar, until u click "signoff".
you see what i am saying?
|
|
|
|
|
Anyone know how to convert from an Icon file to a Cursor file?
Thanks,
Tim
|
|
|
|
|
There are lots of tools dwelling on the net.
I use Conware's IconArt[^] which is freeware .
Cheers,
Pablo.ar
|
|
|
|
|
Dim Ico As Icon = My.Resources.NomeIcona
Me.Cursor = New Cursor(Ico.Handle)
|
|
|
|
|
I have a datagrid bound to a typed dataset. I can obtain the value of the cell by setting the data set to the row and field of the datagrid. i.e.
Form1.CaseLookUpFromGrid =
Caselookds1.tblCases(DataGrid1.CurrentCell.RowNumber).CaseNumber
The problem comes when the the sort function of the datagrid us used. The dataset is not sorted so the value returned is the value that was in the datagrid cell prior to the sort.
Is there a way to obtian the value of a cell in a datagrid? This seams like somthing that should be simple.
Nick
|
|
|
|
|
the problem is that once a sort is applied to the data view in the grid, the order of the grids view is out of sync with the order in the underlying data source. this is the intended behavior.
you need to use the CurrencyManager of the datasources binding context to get at the currently selected row.
e.g.
<code>Private Sub DisplayCurrentRow()
Dim cm as CurrencyManager = me.BindingContext(myDataSource.Table1)
Dim currentRow as DataRow = ctype(cm.Current, DataRowView).Row
me.DisplayRow(currentRow)
End Sub
</code>
the currency manager keeps track of which row is currently selected in the underlying datasource, regardless of how it's being displayed.
hope this helps.
-jim
|
|
|
|
|
I have an input property class I want to validate. Any part that fails the validation should trigger a function which will add the property class to an array of that class with a description of the error. The problem is that each time the description is updated the entire array is changed. Has anyone run into this issue before and how can it be fixed. Here is a sample of my code.
<br />
Friend Function LineCheck(ByVal LineIn As Line) As Line()<br />
Dim LineOut() As Line<br />
If LineIn.Field1 = "" Then LineOut = AddError(LineIn, "Field1 Blank", LineOut)<br />
If LineIn.Field2 = "" Then LineOut = AddError(LineIn, "Field2 Blank", LineOut)<br />
If LineIn.Field3 = "" Then LineOut = AddError(LineIn, "Field3 Blank", LineOut)<br />
If LineIn.Field4 = "" Then LineOut = AddError(LineIn, "Field4 Blank", LineOut)<br />
Return LineOut<br />
End Function<br />
<br />
Friend Function AddError(ByVal LineIn As Line, ByVal LineError As String, ByVal LineOut() As Line) As Line()<br />
Dim tmp As New Line<br />
tmp = LineIn<br />
tmp.LineError = LineError<br />
If Not LineOut Is Nothing Then ReDim Preserve LineOut(LineOut.Length) Else ReDim Preserve LineOut(0)<br />
LineOut(LineOut.Length - 1) = New Line<br />
LineOut(LineOut.Length - 1) = tmp<br />
Return LineOut<br />
End Function<br />
Thank you,
Jason W.
|
|
|
|
|
Uhhh... Why are you passing the LineOut array to the AddError function and AT THE SAME TIME using it to store a return from the very same function? You're AddError function should not be returning data to the same variable using two different methods at the same time.
I have no idea what your trying to do here, but this is approximately what your AddError might look like:
Friend Function LineCheck(ByVal LineIn As Line) As Line()
Dim LineOut() As Line
If LineIn.Field1 = "" Then AddError(LineIn, "Field1 Blank", LineOut)
If LineIn.Field2 = "" Then AddError(LineIn, "Field2 Blank", LineOut)
If LineIn.Field3 = "" Then AddError(LineIn, "Field3 Blank", LineOut)
If LineIn.Field4 = "" Then AddError(LineIn, "Field4 Blank", LineOut)
Return LineOut
End Function
Friend Sub AddError(ByVal LineIn As Line, ByVal LineError As String, ByRef LineOut() As Line)
Dim tmp As New Line
tmp = LineIn
tmp.LineError = LineError
If Not LineOut Is Nothing Then ReDim Preserve LineOut(LineOut.Length) Else ReDim Preserve LineOut(0)
LineOut(LineOut.Length - 1) = New Line
LineOut(LineOut.Length - 1) = tmp
End Sub
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have an application that reads a file out of a phone and has a large string of hex data. I convert that data to ascii using the CHR command and am able to make a jpeg file and view what the picture is.
The problem I am having is that on systems that use asian language packs, the CHR function is incorrectly converting my data I think due to DBCS.
What I am looking for is a way to convert the hex data string I have to ascii that is universal and system independant.
Any idea out there? Thanks very much.
Jim Theisen
|
|
|
|
|
Since your code is getting the hex data completely unencoded, you'll have to detect for the existance of double byte characters yourself. Then provide alternate conversion code to handle this situation.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I am trying to fix teh col width of my datagrid but I get an error
@ dbgrd.GridColumnStyles(0).Width = 50
The error Msg is :
An unhadled exception of type 'System.ArgumentOutOfRangeEception'
Occured in mscorlib.dll.
Addional Information: Index was out of range. Must be non negative and less than the size of the collection.
Code:
With ds.Tables("Ord1")
Dim iCount As Integer
Dim nRow As Data.DataRow
For iCount = 0 To .Rows.Count - 1
nRow = objDT.NewRow()
nRow(0) = CType(.Rows(iCount).Item(0), String)
nRow(1) = CType(.Rows(iCount).Item(1), String)
nRow(2) = CType(.Rows.Item(iCount).Item(2), Long)
objDT.Rows.Add(nRow)
Next
Dim dbgrd1 As DataGridTableStyle = New DataGridTableStyle()
dbGrid1.DataSource = objDT
dbGrid1.ReadOnly = True
Dim dbgrd As DataGridTableStyle = New DataGridTableStyle()
dbgrd.MappingName = "Ord1"
dbGrid1.TableStyles.Add(dbgrd)
dbgrd.GridColumnStyles(0).Width = 50
dbgrd.GridColumnStyles(1).Width = 500
dbgrd.GridColumnStyles(2).Width = 500
can some one help.
Tnx
|
|
|
|
|
hi paps,
you're not actually instantiating any GridColumnStyles in your code. you're just trying to set the width of empty array elements. (GridColumnStyles(0), GridColumnStyles(1), GridColumnStyles(2) etc.) this is the raeson for the exception.
you can try doing this with the vs.net designer as well. just look at the TableStyles property of the datagrid from the properties window. you can set this up so that it's created in the initialization routine of the form rather than manually writing the code for it. take advantage of the code generation module and save yourself a case of carpal tunnels syndrome.
hope this helps.
-jim
|
|
|
|
|
|
When I set the prefered col width to 200 all the other columns too take the same width.
How do I specify the 2nd col with a different width.
Tnx
|
|
|
|
|
hi paps,
the preferred width property is on the tablestyle object. this will set the width of any columnstyle in the tablestyles gridcolumnstyles property that has a width value of 0.
if you set the width property of the columnstyle, the width of that column will be set accordingly.
hope this helps.
-jim
|
|
|
|
|
hi paps,
the gridcolumnstyles property belongs to the tablestyles property of the datagrid. so if you are doing this through the designer, have a look at the properties of the datagrid, find the tablestyles property and click the ellipsis button [...]. this should open the tablestyles editor dialog. next look for the columnstyles property in this dialog and click the ellipis button. this will open the columnstyles editor.
hope this helps.
-jim
|
|
|
|
|
I have the following code:
Dim dlgColorPicker As New frmColorPicker
dlgColorPicker.Show vbModal
Is there a way to get a value returned from the dialog? I want to know if the user pressed OK or Cancel. I know I can setup a global variable in frmColorPicker. Is this the only way?
Thanks,
Tim
|
|
|
|
|
I found some slick code to accomplish this:
Calling module:
[code]
Dim dlgColorPicker As New frmColorPicker
Dim iRet as VbMsgBoxResult
iRet = dlgColorPicker.ShowForm
[/code]
In frmColorPicker:
[code]
Private m_ReturnVal as VbMsgBoxResult
Public Function ShowForm() As VbMsgBoxResult
Me.Show vbModal
ShowForm = m_ReturnVal
End Function
Private Sub cmdOK_Click()
m_ReturnVal = vbOK
End Sub
Private Sub cmdCancel_Click()
m_ReturnVal = vbCancel
End Sub
[/code]
|
|
|
|
|
How can I do this?
For example: let's say on form1.vb, i have the following code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
product_code = TextBox1.Text.Substring(0, 4)
'switch over to next window
Dim form2 As New form2
form2.Show()
Endsub
Now, how can I get the value in product_code in Form2.vb ?
|
|
|
|
|
I was told by the mods that this forum is primarly .Net intended, and so I feel compelled to think that you are trying to do this with it, but just in case this hasn't changed since VB6 or you are indeed doing it in VB6, this is (or should I say was) the way to do it:
Declare the variable product_code on a separate .bas 'Module' object, with the Public word, insted of the good ol' 'Dim':
Public product_code As String
in this way you can access product_code from whereever in your project (different Subs, on different Forms, Modules, Class Modules, whatever!)
Hope that helps (and that you ARE doing it in VB6!)
Cheers,
Pablo.ar
|
|
|
|
|
Pablo,
Sorry, I should have clarified. Yes, I am attempting this in vb.net.
I am just starting in programming in .net, with no experience in vb6.
I did try declaring as Public, but with no luck. I'm sure there's a way of declaring variables globally so that this is possible.
By the way, I'm not sure what a .bas module object is. Is this vb6 terminology.
Thanks again for your help,
Mike
|
|
|
|
|
There's no such thing as a "global" variable in the .NET Framework. This goes for every language that targets .NET, not just VB.
The best way to do it is not to share a variable in the form, but to emulate the method Pablo mentioned. For an example of how to do this, check out Working with Multiple Forms in Visual Basic .NET: Upgrading to .NET[^] on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi, looks to me like you're using .net based on the "handles" keyword in your method signature as well as a few other things, so i'll suggest another way for you. (no offense intended pablo! )
the best way to do this would be to set up a friend property on form1 one that gives access to a module level variable in form1. you'll also need a reference to the actual form1 object in form2. some thing like this...
public class form1
inherits system.windows.forms.form
'initialization code
private m_productCode as String
friend property ProductCode() as String
Get
return me.m_productCode
End Get
Set(byval value as string)
me.m_productcode = value
End Set
end property
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
me.ProductCode = textbox1.text.substring(0, 4)
dim frmTwo as new form2
frmTwo.FormOne = me
frmTwo.Show
end sub
end class
*'--- in a separate code file ---'*
class form2
Inherits System.Windows.Forms.Form
private m_formOne as Windows.Forms.Form
Friend Property Form1 as Windows.Forms.Form
Get
return me.m_formOne
End Get
Set(byval value as Windows.Forms.Form)
me.m_formOne = value
End Set
End Property
Private Sub form2_Load(byval sender as object, byval e as system.eventargs) handles form2.Load
'--- this line gives you access to the product code from form1 ---'
dim productCode as string = me.FormOne.ProductCode
End Sub
end class
the freind property in form2 gives form1 access to safely set a field in form2, and vice versa for the friend property in form1.
this code isn't tested and wasn't typed into my editor, so beware of syntaxtual errors. just a warning...
hope this helps
-jim
|
|
|
|
|
yeah, I guess I should've noticed that .Substring thingy and all the args on the event... it passed me by, sorry.
One more idea... do forms still have that .tag property? That was an amazingly useful property, which I worked with many many times!
Pablo.ar
PS: I feel old, hehe.
|
|
|
|