|
how to insert binary data into database by using vb.net?
|
|
|
|
|
What have you tried ? A blob field is usually used, but it depends on the database.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Hello all,
I am trying to create a simple VB application that will overwrite the FAT on a floppy with a set string I select. I found CFloppyDisk 2.0 (which is written in C++), And I cannot figure out how to complile it as a DLL that visual basic will allow me to reference. I realise this is a basic issue, but since the code was existing on this site I was hoping someone might know how to do it.
|
|
|
|
|
If the code was on this site, then it was in an article. Which means, teh forum of the article is the only place you'd especially hope to find help. The articles are submitted by all sorts of people.
If you compile a C++ dll, you can call it from VB using p/invoke. How are you trying to call it, now ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
I am trying to get a random letters from a set of Ascii codes, whereby i am only selecting certain keys (for example, the top row of the keyboard).
I am using this code:
Dim rnd As New Random()
---
Private Sub FORM1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim c1 As Char = Convert.ToChar(rnd.Next(97, 123)) : lblLetter1.Text = c1.ToString()
---
However, i cannot add more than the min max values in the next column, is there a way to do this, i.e. 97, 101, 105, 106...etc.
Cheers
|
|
|
|
|
Create a string containing the keys you want to choose from.
Dim keysToUse as String = "QWERTYUIOP"
Private Sub FORM1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim c1 as Char = ' '
while (Not keysToUse.Contains(c1))
c1 = Convert.ToChar(rnd.Next(97, 123))
This should keep looping until it selects a character that is in your string. Remember it will be case sensitive.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Put the characters that you want in a string, and pick one character from the string.
Dim chars As String = "qwertyuiop"
Dim rnd As Random = new Random()
Dim index As Integer = rnd.Next(chars.Length)
Dim c1 As Char = chars.Chars(index)
---
single minded; short sighted; long gone;
|
|
|
|
|
Oh, that works too.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
im confused, sorry, bit new to all this. I have the following, how would i do it on this???
-----
Private Sub frmTestTop_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RandomizeLBL(Me, "lblLetter*")
End Sub
Private Sub RandomizeLBL(ByVal container As Control, ByVal pattern As String)
Dim rnd As New Random
For Each ctrl As Control In container.Controls
Dim lblLetter As Label = TryCast(ctrl, Label)
If lblLetter IsNot Nothing AndAlso lblLetter.Name Like pattern Then
lblLetter.Text = Chr(rnd.Next(97, 122).ToString)
End If
Next
End Sub
-----
Cheers
|
|
|
|
|
harveyhanson wrote: im confused, sorry, bit new to all this.
Not to be rude, but if you couldn't follow either explanation then you probably need to buy a book on VB.NET, and learn the language before working too much with Windows Forms.
Guffa's suggestion is better than mine. You buld a string of acceptable chars and get a random number to get an index into that string, to extract a random char.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
HI, I am usually a C#/ C++/ Java programmer, but I am required to program in VB.net for a school course I am doing. I am a pretty confident programmer, and I have scanned through a couple of VB.net books, but I am really stuck for ideas for a program that will test my knowledge of VB.net to see what I need to work on, any ideas?
|
|
|
|
|
If you're a C# programmer, you already are better at VB.NET than most VB users. The reason is, VB.NET uses the .NET framework, I answer questions in this forum although I don't use VB.NET, because the questions are mostly framework related. VB.NET does have a namespace called Visual Basic, which is full of nasty VB6 stuff. You don't know that stuff, people moving from VB6, tend to use it instead of the better .NET methods. So, you're already ahead, you just need to get used to the syntax.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
If you are familiar with C# then anything you know in C# should be able to be applied in VB.NET. Some possible areas that could be areas to study would be:
1) Game Programming (3D or 2D)
2) Database Management
3) Registry
4) Source Code Optimization
5) Use of Windows API
6) GUI programming, creating user controls that are reusable
A few books that might give you more ideas:
Visual Basic Hacks and Pranks
Hackish C++
Both of the books have many examples of cool programs that helped me learn VB, C#, and C++.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
I want to create reports in vb.net never done it before i am searching on net but just keep coming up with crystal reports, can anybody explain what is the best and easiest for doing reports in vb.net 2003 the reports will consist of review of show from april to april for year to year.
Any hints would be grately appreciated, thank you very much.
|
|
|
|
|
Crystal Reports may well be the easiest way, but there are also free and commercial libraries for rendering reports. There's nothing built into VB itself.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Sir/Madam,
On the form load , I wrote
Application.run(new form1)
and
I got the message that i can't run two messages on the single on single thread
Please help.
Thanks and regards
Pankaj
|
|
|
|
|
amaneet wrote: I got the message that i can't run two messages on the single on single thread
That's correct. But... Why do you want to put Application.Run(...) in a Form's Load handler? You are already running the application.
|
|
|
|
|
Sir,
I read somewhere
Public shared sub functin1()
End Sub
What was the need of using shared keyword.
Public keyword was not enough to make the function shared among
other classs?
Or there is some other utility regarding Shared keyword.
Thanks and regards
Pankaj
|
|
|
|
|
Public and Shared do not mean the same thing.
Public is in a set with Protected , Private and so on. Public means that anything can access it. Protected means that the class and anything derived from it can access it. Private means only the class can access it.
Shared (static in C#) means it is shared amongst all instances of the class. A Shared method does not need any instance of the class to be created. A Shared field on a class means the one value is shared amongs all instances (or even no instances, for an instance is not required) of the class.
|
|
|
|
|
|
Hello
To see the differece with your eyes:
create a class and write to function one with the public and the Other with
shared.
you will find out, to use the first one you must create an instance of the class but to call the second one you dont need.
if you couldn't understand ( with my week English) I'll give you the class.
Good life.
|
|
|
|
|
Have got 1 datagrid displaying the data when the program is run and when i click on a selection in that datagrid it populates another datagrid 2 with the information required, say for instance i have to tables in database 1 shows-this datagrid 1 vb.net,and the other performances this datagrid 2 vb.net.
when i click the datagrid 1 it populates all the performances for that show into the other datagrid showing performance no,date,time,show no but i also need show title to come across but it is in another table shows datagrid 1. any ideas,
|
|
|
|
|
Hi Kendo,
If I understand correctly what you are asking, you can try something like this:
1. populate dataset 1 and bind it to datagrid 1
2. adapt the following code to get the row the user clicked on, and the corresponding cell value:
Private Sub Datagrid1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Datagrid1.MouseDown<br />
Try<br />
Dim myGrid As DataGrid = CType(sender, DataGrid)<br />
Dim hti As System.Windows.Forms.DataGrid.HitTestInfo<br />
hti = myGrid.HitTest(e.X, e.Y)<br />
Dim message As String = "You clicked "<br />
Select Case hti.Type<br />
Case System.Windows.Forms.DataGrid.HitTestType.None<br />
message &= "the background."<br />
Case System.Windows.Forms.DataGrid.HitTestType.Cell<br />
message &= "cell at row " & hti.Row & ", col " & hti.Column<br />
Case System.Windows.Forms.DataGrid.HitTestType.ColumnHeader<br />
message &= "the column header for column " & hti.Column<br />
Case System.Windows.Forms.DataGrid.HitTestType.RowHeader<br />
message &= "the row header for row " & hti.Row<br />
Case System.Windows.Forms.DataGrid.HitTestType.ColumnResize<br />
message &= "the column resizer for column " & hti.Column<br />
Case System.Windows.Forms.DataGrid.HitTestType.RowResize<br />
message &= "the row resizer for row " & hti.Row<br />
Case System.Windows.Forms.DataGrid.HitTestType.Caption<br />
message &= "the caption"<br />
Case System.Windows.Forms.DataGrid.HitTestType.ParentRows<br />
message &= "the parent row"<br />
MsgBox(message)<br />
End Select<br />
Catch Ex As Exception<br />
MsgBox(Ex.Message)<br />
End Try<br />
End Sub
3. Execute a parametrized query to populate dataset 2 with the data you want to show in datagrid 2, using the cell value obtained in the code above.
4. bind dataset 2 to datagrid 2
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi..
I am having a huge problem with getting the selected index changed property of a drop down list when inside a datagrid..
I have two drop down lists inside the datagrid, toSectDDL and tosubSectDDL. What i want is when the user selects an item from the toSectDDL, the tosubSectDDL should be populated with the related subsections for that particular section only..
I have written the VB code as
Protected Sub toSectDDL_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim row As DataGridItem
For Each row In SectionGrid.Items
Dim toSectDDL As DropDownList = CType(SectionGrid.FindControl("toSectDDL"), DropDownList)
Dim toSubSectDDL As DropDownList = CType(SectionGrid.FindControl("toSubSectDDL"), DropDownList)
If toSectDDL.SelectedValue = 0 Then
toSubSectDDL.Items.Insert(0, New ListItem("None", "0"))
Else
toSubSectDDL.DataSource = Office.GetSubSectionsForSection(toSectDDL.SelectedValue)
toSubSectDDL.DataTextField = "subsection"
toSubSectDDL.DataValueField = "subSecID"
toSubSectDDL.DataBind()
toSubSectDDL.Items.Insert(0, New ListItem("Select", "0"))
End If
Next
End Sub
and set the ASP code as
<asp:templatecolumn headertext="toSection">
<itemtemplate>
<asp:dropdownlist id="toSectDDL" runat="server" cssclass="standardDDL" width="402px" onselectedindexchanged="toSectDDL_SelectedIndexChanged" autopostback="True">
Now i am getting a server error saying
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
veyo.OfficeNameChange.toSectDDL_SelectedIndexChanged(Object sender, EventArgs e) in \\aion\intranetroot$\veyo\updateVEYO\OfficeNameChange.aspx.vb:430
System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +108
System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +26
System.Web.UI.Page.RaiseChangedEvents() +115
System.Web.UI.Page.ProcessRequestMain() +1099
Can anyone plz help!!!!!!
|
|
|
|
|
"<asp:TemplateColumn HeaderText="toSection"><ItemTemplate><asp:DropDownList id="toSectDDL" runat="server" CssClass="standardDDL" Width="402px" removed="toSectDDL_SelectedIndexChanged" AutoPostBack="True" ></asp:DropDownList></ItemTemplate></asp:TemplateColumn>"
I would first make sure you check the control for "If IsNothing" before doing anything manipulations to it. Also what is "removed="?
Cleako
|
|
|
|